Struct stens::StructField
source · Fields§
§ty: TypeRef
§optional: bool
Implementations§
source§impl StructField
impl StructField
pub fn with(type_name: &'static str) -> Self
pub fn primitive(prim: PrimitiveType) -> Self
pub fn bytes() -> Self
pub fn ascii_string() -> Self
pub fn unicode_string() -> Self
pub fn array(prim: PrimitiveType, size: u16) -> Self
pub fn list(prim: PrimitiveType) -> Self
pub fn map(key: impl Into<KeyType>, prim: PrimitiveType) -> Self
pub fn typed_list(ty: &'static str) -> Self
pub fn typed_map(key: impl Into<KeyType>, ty: &'static str) -> Self
pub fn optional(ty: TypeRef) -> Self
Trait Implementations§
source§impl Clone for StructField
impl Clone for StructField
source§fn clone(&self) -> StructField
fn clone(&self) -> StructField
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for StructField
impl Debug for StructField
source§impl Display for StructField
impl Display for StructField
source§impl Hash for StructField
impl Hash for StructField
source§impl Ord for StructField
impl Ord for StructField
source§fn cmp(&self, other: &StructField) -> Ordering
fn cmp(&self, other: &StructField) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<StructField> for StructField
impl PartialEq<StructField> for StructField
source§fn eq(&self, other: &StructField) -> bool
fn eq(&self, other: &StructField) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<StructField> for StructField
impl PartialOrd<StructField> for StructField
source§fn partial_cmp(&self, other: &StructField) -> Option<Ordering>
fn partial_cmp(&self, other: &StructField) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl StrictDecode for StructField
impl StrictDecode for StructField
source§fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given
std::io::Read
instance; must either
construct an instance or return implementation-specific error type.source§fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures.source§fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
Reads data from file at
path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction.source§impl StrictEncode for StructField
impl StrictEncode for StructField
source§fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given
std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.source§fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using
StrictEncode::strict_encode
function