pub struct Block { /* private fields */ }Implementations§
Source§impl Block
impl Block
pub fn new(version: Version, uid: &[u8; 6], block_type: BlockType) -> Block
pub fn dummy() -> Block
pub fn get_version(&self) -> Version
pub fn set_version(&mut self, version: Version)
pub fn get_uid(&self) -> [u8; 6]
pub fn set_uid(&mut self, uid: [u8; 6])
pub fn get_crc(&self) -> u16
pub fn get_seq_num(&self) -> u32
pub fn set_seq_num(&mut self, seq_num: u32)
pub fn add_seq_num(&mut self, val: u32) -> Result<(), Error>
pub fn add1_seq_num(&mut self) -> Result<(), Error>
pub fn block_type(&self) -> BlockType
pub fn is_meta(&self) -> bool
pub fn is_data(&self) -> bool
pub fn is_parity(&self, data_shards: usize, parity_shards: usize) -> bool
pub fn get_meta_ref_by_id( &self, id: MetadataID, ) -> Result<Option<&Metadata>, Error>
pub fn get_meta_ref_mut_by_id( &mut self, id: MetadataID, ) -> Result<Option<&mut Metadata>, Error>
pub fn get_FNM(&self) -> Result<Option<String>, Error>
pub fn get_SNM(&self) -> Result<Option<String>, Error>
pub fn get_FSZ(&self) -> Result<Option<u64>, Error>
pub fn get_FDT(&self) -> Result<Option<i64>, Error>
pub fn get_SDT(&self) -> Result<Option<i64>, Error>
pub fn get_HSH(&self) -> Result<Option<(HashType, Box<[u8]>)>, Error>
pub fn get_RSD(&self) -> Result<Option<u8>, Error>
pub fn get_RSP(&self) -> Result<Option<u8>, Error>
pub fn meta(&self) -> Result<&Vec<Metadata>, Error>
pub fn meta_mut(&mut self) -> Result<&mut Vec<Metadata>, Error>
pub fn calc_crc(&self, buffer: &[u8]) -> u16
pub fn update_crc(&mut self, buffer: &[u8])
pub fn sync_to_buffer( &mut self, update_crc: Option<bool>, buffer: &mut [u8], ) -> Result<(), Error>
pub fn sync_from_buffer_header_only( &mut self, buffer: &[u8], ) -> Result<(), Error>
pub fn sync_from_buffer( &mut self, buffer: &[u8], pred: Option<&dyn Fn(&Block) -> bool>, ) -> Result<(), Error>
pub fn verify_crc(&self, buffer: &[u8]) -> Result<bool, Error>
pub fn enforce_crc(&self, buffer: &[u8]) -> Result<(), Error>
Trait Implementations§
impl StructuralPartialEq for Block
Auto Trait Implementations§
impl Freeze for Block
impl RefUnwindSafe for Block
impl Send for Block
impl Sync for Block
impl Unpin for Block
impl UnwindSafe for Block
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more