Struct hypercore::Node [−][src]
pub struct Node { /* fields omitted */ }
Nodes that are persisted to disk.
Methods
impl Node
[src]
impl Node
pub fn new(index: usize, hash: Vec<u8>, length: usize) -> Self
[src]
pub fn new(index: usize, hash: Vec<u8>, length: usize) -> Self
Create 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 Debug for Node
[src]
impl Debug for Node
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Node
[src]
impl Clone for Node
fn clone(&self) -> Node
[src]
fn clone(&self) -> Node
Returns 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)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl PartialEq for Node
[src]
impl PartialEq for Node
fn eq(&self, other: &Node) -> bool
[src]
fn eq(&self, other: &Node) -> bool
This 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) -> bool
This method tests for !=
.
impl Eq for Node
[src]
impl Eq for Node
impl NodeTrait for Node
[src]
impl NodeTrait for Node
fn index(&self) -> usize
[src]
fn index(&self) -> usize
Get 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) -> usize
Get the length of the node.
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Check if the length is zero.
fn parent(&self) -> usize
[src]
fn parent(&self) -> usize
Get the position of the parent of the node.
impl AsRef<Node> for Node
[src]
impl AsRef<Node> for Node
impl Display for Node
[src]
impl Display for Node