[−][src]Struct hypercore::Node
Nodes that are persisted to disk.
Methods
impl Node[src]
impl Nodepub fn new(index: usize, hash: Vec<u8>, length: usize) -> Self[src]
pub fn new(index: usize, hash: Vec<u8>, length: usize) -> SelfCreate a new instance.
pub fn from_bytes(index: usize, buffer: &[u8]) -> Result<Self>[src]
pub fn from_bytes(index: usize, buffer: &[u8]) -> Result<Self>Convert a vector to a new instance.
Requires the index at which the buffer was read to be passed.
pub fn to_bytes(&self) -> Result<Vec<u8>>[src]
pub fn to_bytes(&self) -> Result<Vec<u8>>Convert to a buffer that can be written to disk.
Trait Implementations
impl Clone for Node[src]
impl Clone for Nodefn clone(&self) -> Node[src]
fn clone(&self) -> NodeReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq<Node> for Node[src]
impl PartialEq<Node> for Nodefn eq(&self, other: &Node) -> bool[src]
fn eq(&self, other: &Node) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Node) -> bool[src]
fn ne(&self, other: &Node) -> boolThis method tests for !=.
impl Eq for Node[src]
impl Eq for Nodeimpl AsRef<Node> for Node[src]
impl AsRef<Node> for Nodeimpl Debug for Node[src]
impl Debug for Nodefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Display for Node[src]
impl Display for Nodefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Node for Node[src]
impl Node for Nodefn index(&self) -> usize[src]
fn index(&self) -> usizeGet the position at which the node was found.
fn hash(&self) -> &[u8][src]
fn hash(&self) -> &[u8]Get the hash contained in the node.
fn len(&self) -> usize[src]
fn len(&self) -> usizeGet the length of the node.
fn is_empty(&self) -> bool[src]
fn is_empty(&self) -> boolCheck if the length is zero.
fn parent(&self) -> usize[src]
fn parent(&self) -> usizeGet the position of the parent of the node.
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized, [src]
impl<T> ToString for T where
T: Display + ?Sized, impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, type Owned = T
fn to_owned(&self) -> T[src]
fn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)[src]
fn clone_into(&self, target: &mut T)🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more
impl<T> Same for T
impl<T> Same for Ttype Output = T
Should always be Self