pub struct ObjectData {
pub header: Header,
pub frames: Frames,
}
Fields§
§header: Header
§frames: Frames
Implementations§
Source§impl ObjectData
impl ObjectData
Sourcepub fn open(path: &Path) -> Result<String, Error<'static>>
pub fn open(path: &Path) -> Result<String, Error<'static>>
Returns the object data string, decoding it if necessary.
§Parameters
path
: Path to the object data file to open.
Examples found in repository?
More examples
examples/demo.rs (line 17)
5fn run() -> Result<(), Error<'static>> {
6 let mut args_os = env::args_os();
7
8 // Skip first argument, which tends to be the application name.
9 args_os.next();
10
11 if args_os.len() == 0 {
12 print_help();
13 }
14
15 args_os.try_for_each(|arg_os| {
16 let path = Path::new(&arg_os);
17 let contents = ObjectData::open(&path)?;
18
19 match ObjectData::try_from(contents.as_ref()) {
20 Ok(object_data) => println!("{:#?}", object_data),
21 Err(e) => eprintln!("{}", e),
22 }
23
24 Result::<(), Error>::Ok(())
25 })?;
26
27 Ok(())
28}
Trait Implementations§
Source§impl Debug for ObjectData
impl Debug for ObjectData
Source§impl Default for ObjectData
impl Default for ObjectData
Source§fn default() -> ObjectData
fn default() -> ObjectData
Returns the “default value” for a type. Read more
Source§impl PartialEq for ObjectData
impl PartialEq for ObjectData
Source§impl<'s> TryFrom<&'s str> for ObjectData
impl<'s> TryFrom<&'s str> for ObjectData
impl StructuralPartialEq for ObjectData
Auto Trait Implementations§
impl Freeze for ObjectData
impl RefUnwindSafe for ObjectData
impl Send for ObjectData
impl Sync for ObjectData
impl Unpin for ObjectData
impl UnwindSafe for ObjectData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more