Skip to main content

LSB_MSB

Struct LSB_MSB 

Source
pub struct LSB_MSB<T> { /* private fields */ }

Implementations§

Source§

impl<T: Copy> LSB_MSB<T>

Source

pub fn get(&self) -> T

Examples found in repository?
examples/dump.rs (line 48)
23fn main() {
24    // Get last argument in command line
25
26    let mut args = std::env::args();
27
28    if args.len() < 2 {
29        println!("Usage: {} <filename>", args.next().unwrap());
30        std::process::exit(1);
31    }
32
33    let filename = args.nth(args.len() - 1).unwrap();
34
35    let file = File::open(filename).unwrap();
36    let mut iso = match ISO9660::from_device(FileDevice(file)) {
37        Some(iso) => iso,
38        None => {
39            eprintln!("It's not an ISO9660 (*.iso) file!");
40            std::process::exit(1);
41        },
42    };
43
44    fn dump(reader: &mut ISO9660, lba: u32, level: usize) {
45        let data = reader.read_directory(lba as _);
46
47        for i in data.collect::<Vec<_>>() {
48            let size = i.record.data_length.get();
49
50            println!("{:<offset$}[{}] {} - {} bytes", "", if i.is_file() { "FILE" } else { "DIR" }, i.name, size, offset = level * 4);
51
52            if ![".", ".."].contains(&i.name.as_str()) && i.is_folder() {
53                dump(reader, i.record.lba.get(), level + 1);
54            }
55        }
56    }
57
58    let root_lba = iso.root().lba.get();
59    dump(&mut iso, root_lba, 0);
60}

Trait Implementations§

Source§

impl<T: Clone + Copy> Clone for LSB_MSB<T>

Source§

fn clone(&self) -> LSB_MSB<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Copy> Debug for LSB_MSB<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for LSB_MSB<T>

Source§

fn default() -> LSB_MSB<T>

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

impl<T> FromBytes for LSB_MSB<T>
where T: FromBytes,

Source§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
Source§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
Source§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl<T> FromZeros for LSB_MSB<T>
where T: FromZeros,

Source§

fn zero(&mut self)

Overwrites self with zeros. Read more
Source§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

impl<T> IntoBytes for LSB_MSB<T>
where T: IntoBytes,

Source§

fn as_bytes(&self) -> &[u8]
where Self: Immutable,

Gets the bytes of this value. Read more
Source§

fn as_mut_bytes(&mut self) -> &mut [u8]
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
Source§

fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to dst. Read more
Source§

fn write_to_prefix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the prefix of dst. Read more
Source§

fn write_to_suffix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the suffix of dst. Read more
Source§

impl<T> TryFromBytes for LSB_MSB<T>
where T: TryFromBytes,

Source§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
Source§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
Source§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl<T: Copy> Copy for LSB_MSB<T>

Source§

impl<T> Immutable for LSB_MSB<T>
where T: Immutable,

Auto Trait Implementations§

§

impl<T> Freeze for LSB_MSB<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for LSB_MSB<T>
where T: RefUnwindSafe,

§

impl<T> Send for LSB_MSB<T>
where T: Send,

§

impl<T> Sync for LSB_MSB<T>
where T: Sync,

§

impl<T> Unpin for LSB_MSB<T>
where T: Unpin,

§

impl<T> UnwindSafe for LSB_MSB<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.