Struct CRFrame

Source
pub struct CRFrame {
    pub index: HashMap<String, (u64, CRFrameObjectType)>,
    pub bytestorage: Vec<u8>,
}
Expand description

The central data container of the caraspace suite.

A CRFrame can hold multiple CRFrameObjects and is basically a little sclerite of the entire skeleton.

Fields§

§index: HashMap<String, (u64, CRFrameObjectType)>§bytestorage: Vec<u8>

Implementations§

Source§

impl CRFrame

Source

pub fn new() -> Self

Source

pub fn serialize_index(&self) -> Vec<u8>

Source

pub fn parse_index( stream: &Vec<u8>, pos: &mut usize, ) -> HashMap<String, (u64, CRFrameObjectType)>

Source

pub fn delete(&self, name: &str) -> Result<CRFrame, CRSerializationError>

Delete a CRFrameObject by this name from the frame

To delete multiple objects, delete calls can be chained

§Arguments:
  • name : The name of the FrameObject to delte (must be in index)
§Returns:

A complete copy of self, without the given object.

Source

pub fn put<T: CRSerializeable + Frameable>(&mut self, object: T, name: String)

Store any eligible object in the frame

Eligible object must implement the “Frameable” trait

Source

pub fn has(&self, name: &str) -> bool

Check if the frame contains an object with the given name

§Arguments:
  • name : The name of the object as it appears in the index
Source

pub fn get_fobject( &self, name: &str, ) -> Result<CRFrameObject, CRSerializationError>

Source

pub fn get<T: CRSerializeable + Frameable>( &self, name: String, ) -> Result<T, CRSerializationError>

Source

pub fn show_frame(&self) -> String

A verbose display of the frame content

Trait Implementations§

Source§

impl CRSerializeable for CRFrame

Source§

fn deserialize( stream: &Vec<u8>, pos: &mut usize, ) -> Result<Self, CRSerializationError>

Decode a serializable from a bytestream

Source§

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

Encode a serializable to a bytestream

Source§

const CRHEAD: u16 = 43_690u16

Source§

const CRTAIL: u16 = 21_845u16

Source§

const CRSIZE: usize = 0usize

The SIZE is the size of the serialized bytestream INCLUDING 4 bytes for head and tail bytes. In case the struct does NOT HAVE a fixed size, SIZE will be 0 (so default value of the trait
Source§

fn verify_fixed( stream: &Vec<u8>, pos: &mut usize, ) -> Result<(), CRSerializationError>

Verify that the serialized representation of the struct has the correct size, including header + footer. Read more
Source§

impl Clone for CRFrame

Source§

fn clone(&self) -> CRFrame

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 Debug for CRFrame

Source§

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

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

impl Display for CRFrame

Source§

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

Formats the value using the given formatter. 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> 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> 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.
Source§

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