pub struct Bytes<T: Prefix> {
pub value: u64,
pub prefix: T,
}
Expand description
A number of bytes.
Fields§
§value: u64
§prefix: T
Implementations§
Trait Implementations§
source§impl<'de, T: Prefix> Deserialize<'de> for Bytes<T>
impl<'de, T: Prefix> Deserialize<'de> for Bytes<T>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Prefix> JsonSchema for Bytes<T>
impl<T: Prefix> JsonSchema for Bytes<T>
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§impl<T: Prefix> Unit for Bytes<T>
impl<T: Prefix> Unit for Bytes<T>
type U = u64
type T = T
fn suffixes() -> &'static [&'static str]
source§fn convert(&self, prefix: Self::T) -> Result<Self, String>
fn convert(&self, prefix: Self::T) -> Result<Self, String>
Convert value to a different prefix, but return an error if the conversion
cannot be done without possibly losing precision.
source§fn convert_lossy(&self, prefix: Self::T) -> Self
fn convert_lossy(&self, prefix: Self::T) -> Self
Convert value to a different prefix, even if it loses precision.
impl<T: Copy + Prefix> Copy for Bytes<T>
impl<T: Eq + Prefix> Eq for Bytes<T>
impl<T: Prefix> StructuralPartialEq for Bytes<T>
Auto Trait Implementations§
impl<T> Freeze for Bytes<T>where
T: Freeze,
impl<T> RefUnwindSafe for Bytes<T>where
T: RefUnwindSafe,
impl<T> Send for Bytes<T>where
T: Send,
impl<T> Sync for Bytes<T>where
T: Sync,
impl<T> Unpin for Bytes<T>where
T: Unpin,
impl<T> UnwindSafe for Bytes<T>where
T: UnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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