Skip to main content

Reader

Struct Reader 

Source
pub struct Reader {
    pub amf3_decoder: AMF3Decoder,
    pub amf0_decoder: AMF0Decoder,
}
Expand description

The main entry point of decoding an LSO file Example of use

use std::fs::File;
use std::io::Read;
use flash_lso::read::Reader;
let mut x = File::open("tests/sol/AS2-Demo.sol").expect("Couldn't open file");
let mut data = Vec::new();
let _ = x.read_to_end(&mut data).expect("Unable to read file");
let d = Reader::default().parse(&data).expect("Failed to parse lso file");
println!("{:#?}", d);

}

Fields§

§amf3_decoder: AMF3Decoder

Handles reading Amf3 data

§amf0_decoder: AMF0Decoder

Handles reading Amf0 data

Implementations§

Source§

impl Reader

Source

pub fn parse_header<'a>(&self, i: &'a [u8]) -> AMFResult<'a, Header>

Read a Lso header from the given slice

Source

pub fn parse_incomplete<'a>(&mut self, i: &'a [u8]) -> AMFResult<'a, Lso>

Read a given buffer as an Lso

Unlike parse, this function will not error if the entire slice isn’t consumed and will return the data that was not parsed

Source

pub fn parse<'a>(&mut self, i: &'a [u8]) -> Result<Lso, Err<Error<'a>>>

Read a given slice as an Lso

This function will return an error if the slice could not be parsed or if the entire slice was not consumed

Trait Implementations§

Source§

impl Default for Reader

Source§

fn default() -> Reader

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Reader

§

impl !Send for Reader

§

impl !Sync for Reader

§

impl !UnwindSafe for Reader

§

impl Freeze for Reader

§

impl Unpin for Reader

§

impl UnsafeUnpin for Reader

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.