pub struct StandardChunkSet;Expand description
Standard Swarm chunk type set.
This set includes the two fundamental chunk types in the Swarm network:
- Content-addressed chunks (CAC) -
ChunkTypeId::CONTENT - Single-owner chunks (SOC) -
ChunkTypeId::SINGLE_OWNER
This is the default chunk set used by most Swarm nodes.
§Example
ⓘ
use nectar_primitives::{ChunkTypeSet, ChunkTypeId, StandardChunkSet};
// Check support
assert!(StandardChunkSet::supports(ChunkTypeId::CONTENT));
assert!(StandardChunkSet::supports(ChunkTypeId::SINGLE_OWNER));
// Deserialize a chunk
let bytes: &[u8] = /* serialized chunk bytes */;
let chunk = StandardChunkSet::deserialize(bytes)?;Trait Implementations§
Source§impl<const BODY_SIZE: usize> ChunkTypeSet<BODY_SIZE> for StandardChunkSet
impl<const BODY_SIZE: usize> ChunkTypeSet<BODY_SIZE> for StandardChunkSet
Source§fn supports(type_id: ChunkTypeId) -> bool
fn supports(type_id: ChunkTypeId) -> bool
Check if a chunk type ID is supported by this set. Read more
Source§fn deserialize(bytes: &[u8]) -> Result<AnyChunk<BODY_SIZE>>
fn deserialize(bytes: &[u8]) -> Result<AnyChunk<BODY_SIZE>>
Deserialize bytes into the appropriate chunk type. Read more
Source§fn supported_types() -> &'static [ChunkTypeId]
fn supported_types() -> &'static [ChunkTypeId]
Get the list of all supported type IDs. Read more
Source§fn format_supported_types() -> String
fn format_supported_types() -> String
Format the supported chunk types as a human-readable string. Read more
Source§impl Clone for StandardChunkSet
impl Clone for StandardChunkSet
Source§fn clone(&self) -> StandardChunkSet
fn clone(&self) -> StandardChunkSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StandardChunkSet
Source§impl Debug for StandardChunkSet
impl Debug for StandardChunkSet
Source§impl Default for StandardChunkSet
impl Default for StandardChunkSet
Source§fn default() -> StandardChunkSet
fn default() -> StandardChunkSet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StandardChunkSet
impl RefUnwindSafe for StandardChunkSet
impl Send for StandardChunkSet
impl Sync for StandardChunkSet
impl Unpin for StandardChunkSet
impl UnsafeUnpin for StandardChunkSet
impl UnwindSafe for StandardChunkSet
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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