pub struct Field {
pub name: String,
pub kind: FieldKind,
pub width: u32,
pub optional: bool,
}Expand description
One field of a layout.
Fields§
§name: String§kind: FieldKind§width: u32From 1 to 64.
optional: boolImplementations§
Source§impl Field
impl Field
Sourcepub fn code(&self, v: &Value, epoch: Option<i64>) -> Result<u64, WriteRefusal>
pub fn code(&self, v: &Value, epoch: Option<i64>) -> Result<u64, WriteRefusal>
The code a writer gives v, the field’s JSON value as §7.6’s
reading spells it, with the deployment epoch a time field needs: a
frame’s fields are written one by one (core §7.7).
§Errors
The writer’s refusal: WriteRefusal.
Sourcepub fn reserved_name(&self, code: u64) -> Option<&'static str>
pub fn reserved_name(&self, code: u64) -> Option<&'static str>
The reserved code’s name, when code is one this field declares:
a code that is no value (core §7.6), as a frame’s deadband reads it
(§7.7).
Sourcepub fn value(&self, code: u64, epoch: Option<i64>) -> Result<Value, ReadRefusal>
pub fn value(&self, code: u64, epoch: Option<i64>) -> Result<Value, ReadRefusal>
The JSON value a reader reads from code, as §7.6’s reading spells
it.
§Errors
ReadRefusal::Code for an unused code, ReadRefusal::Epoch for
a time field and no epoch.
Sourcepub fn check_code(&self, code: u64) -> Result<(), ReadRefusal>
pub fn check_code(&self, code: u64) -> Result<(), ReadRefusal>
Trait Implementations§
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Forget for Field
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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