Skip to main content

SequentialText

Struct SequentialText 

Source
pub struct SequentialText {
    pub header: Vec<u8>,
    pub text: Vec<u8>,
}
Expand description

Structured representation of text files on disk. There is a page structure that we do not put into the structure. As a result the decoder must pass over nulls, the encoder must insert them.

Fields§

§header: Vec<u8>§text: Vec<u8>

Trait Implementations§

Source§

impl DiskStruct for SequentialText

Source§

fn new() -> Self

Create an empty structure

Source§

fn from_bytes(dat: &[u8]) -> Result<Self, DiskStructError>

Create structure using flattened bytes (typically from disk) Due to the pagination, we must keep all the nulls.

Source§

fn to_bytes(&self) -> Vec<u8>

Return flattened bytes (typically written to disk)

Source§

fn update_from_bytes(&mut self, dat: &[u8]) -> Result<(), DiskStructError>

Update with flattened bytes (useful mostly as a crutch within a2kit_macro)

Source§

fn len(&self) -> usize

Length of the flattened structure

Source§

fn from_bytes_adv( bytes: &[u8], ptr: &mut usize, ) -> Result<Self, DiskStructError>
where Self: Sized,

convenience function to call from_bytes and increment ptr by len()
Source§

impl Display for SequentialText

Allows the text to be displayed to the console using println!. This also derives to_string, so the structure can be converted to String.

Source§

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

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

impl FromStr for SequentialText

Allows the structure to be created from string slices using from_str.

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.