Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

lib.rs 866 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  1. extern crate quick_xml;
  2. pub mod cleaning;
  3. pub mod tsv;
  4. use std::io;
  5. use std::fmt;
  6. use std::error::Error;
  7. #[derive(Debug)]
  8. pub enum BDError {
  9. IO(io::Error),
  10. XML(quick_xml::Error),
  11. UTF8(std::str::Utf8Error),
  12. Misc(String)
  13. }
  14. impl fmt::Display for BDError {
  15. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  16. write!(f, "{:?}", self)
  17. }
  18. }
  19. impl From<io::Error> for BDError {
  20. fn from(err: io::Error) -> BDError {
  21. BDError::IO(err)
  22. }
  23. }
  24. impl From<std::str::Utf8Error> for BDError {
  25. fn from(err: std::str::Utf8Error) -> BDError {
  26. BDError::UTF8(err)
  27. }
  28. }
  29. impl From<quick_xml::Error> for BDError {
  30. fn from(err: quick_xml::Error) -> BDError {
  31. BDError::XML(err)
  32. }
  33. }
  34. pub fn err(msg: &str) -> BDError {
  35. BDError::Misc(msg.to_string())
  36. }
  37. /// Typedef for all-purpose result type.
  38. pub type Result<R> = std::result::Result<R, BDError>;
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...