Struct LfnBuffer

Source
pub struct LfnBuffer<'a> { /* private fields */ }
Expand description

Used to store a Long File Name

Implementations§

Source§

impl<'a> LfnBuffer<'a>

Source

pub fn new(storage: &'a mut [u8]) -> LfnBuffer<'a>

Create a new, empty, LFN Buffer using the given mutable slice as its storage.

Source

pub fn clear(&mut self)

Empty out this buffer

Source

pub fn push(&mut self, buffer: &[u16; 13])

Push the 13 UTF-16 codepoints into this string.

We assume they are pushed last-chunk-first, as you would find them on disk.

Any chunk starting with a half of a surrogate pair has that saved for the next call.

[de00, 002e, 0074, 0078, 0074, 0000, ffff, ffff, ffff, ffff, ffff, ffff, ffff]
[0041, 0042, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, 0038, 0039, d83d]

Would map to

0041 0042 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 1f600 002e 0074 0078 0074, or

"AB0123456789😀.txt"
Source

pub fn as_str(&self) -> &str

View this LFN buffer as a string-slice

If the buffer overflowed while parsing the LFN, or if this buffer is empty, you get an empty string.

Trait Implementations§

Source§

impl<'a> Debug for LfnBuffer<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for LfnBuffer<'a>

§

impl<'a> RefUnwindSafe for LfnBuffer<'a>

§

impl<'a> Send for LfnBuffer<'a>

§

impl<'a> Sync for LfnBuffer<'a>

§

impl<'a> Unpin for LfnBuffer<'a>

§

impl<'a> !UnwindSafe for LfnBuffer<'a>

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.