Trait ObjStr

Source
pub trait ObjStr {
    // Required methods
    fn seek(&mut self, pos: SeekFrom) -> Result<(), Error>;
    fn read(&mut self) -> Result<Vec<u8>, Error>;
    fn len(&mut self, contents: u8, objs: u8) -> Result<u64, Error>;
    fn overwrite(&mut self, data: Vec<Vec<u8>>, objs: u8) -> Result<(), Error>;
    fn append(&mut self, data: Vec<u8>) -> Result<(), Error>;
    fn cut(&mut self) -> Result<(), Error>;
}

Required Methods§

Source

fn seek(&mut self, pos: SeekFrom) -> Result<(), Error>

Seeks to the given object in the stream.

Source

fn read(&mut self) -> Result<Vec<u8>, Error>

Read the next object from the stream.

Source

fn len(&mut self, contents: u8, objs: u8) -> Result<u64, Error>

Returns the length of the current object (+ the following objects if objs > 1) and subtracts ops*contents from the length.

If contents::0 and objs::0, 0 is returned.

If contents::0 and objs::1, the length of the current object is returned.

If contents::1 and objs::0, error occurs.

If contents::1 and objs::1, the length of the current object-content is returned.

If contents::1 and objs::2, the length of the current object plus the length of the following object is subtracted 4op_code(2op_set) returned.

If contents::2 and objs::0, error occurs.

If contents::2 and objs::1, the length of the current object subtracted 4op_code(2op_set) is returned.

Source

fn overwrite(&mut self, data: Vec<Vec<u8>>, objs: u8) -> Result<(), Error>

Overwrites the current object or objects with the given object-contents.

If objs::0, error occurs.

If objs::1 and data.len() < 1, error occurs.

If objs::1 and data.len() == 1, the current object is overwritten.

If objs::2 and data.len() == 1, the current object and the following object are overwritten.

If objs::1 and data.len() < 1, the current object will be overwritten with multiple objects.

If objs::2 and data.len() < 1, the current object and the following objects will be overwritten with multiple objects.

Source

fn append(&mut self, data: Vec<u8>) -> Result<(), Error>

Appends an object to the end of the stream.

Source

fn cut(&mut self) -> Result<(), Error>

Deletes the current and all following objects.

Implementors§