pub struct Interface {
pub groups: Groups,
pub derived: Derived,
}Expand description
A config interface’s declaration and derived types: everything a writer and a reader of its wire need from its contract.
Fields§
§groups: Groups§derived: DerivedImplementations§
Source§impl Interface
impl Interface
Sourcepub fn read(
annotation: &Json,
files: &[(&str, &Json)],
) -> Result<Self, Vec<Invalid>>
pub fn read( annotation: &Json, files: &[(&str, &Json)], ) -> Result<Self, Vec<Invalid>>
Reads a declaration against its packed files, and derives its types.
§Errors
Groups::read’s reasons.
Source§impl Interface
impl Interface
Sourcepub fn fields(&self, s: &State) -> Json
pub fn fields(&self, s: &State) -> Json
A record’s JSON reading (core §7.6): its fields by name, an absent optional field no member, a time in milliseconds since the Unix epoch.
Sourcepub fn write_record(
&self,
s: &State,
epoch: i64,
) -> Result<Record, WriteRefusal>
pub fn write_record( &self, s: &State, epoch: i64, ) -> Result<Record, WriteRefusal>
Writes a record under the deployment epoch, in seconds (§2.3).
§Errors
The packed writer’s refusal: a value outside its field, a time before the epoch or past its 32 bits.
Sourcepub fn read_record(
&self,
tag: u8,
bytes: &[u8],
epoch: i64,
) -> Result<State, RecordRefusal>
pub fn read_record( &self, tag: u8, bytes: &[u8], epoch: i64, ) -> Result<State, RecordRefusal>
Reads a record under its CH’s tag and the deployment epoch, refusing it for the first of §2.3’s checks that applies.
§Errors
The RecordRefusal.
Sourcepub fn state_of(&self, fields: &Json) -> Result<State, RecordRefusal>
pub fn state_of(&self, fields: &Json) -> Result<State, RecordRefusal>
A record’s JSON reading read as a State, with §2.3’s checks
after core §7.6’s: group, pending, last, desired, then
parameter.
§Errors
The first RecordRefusal that applies.
Source§impl Interface
impl Interface
Sourcepub fn decode_set(
&self,
group: &str,
payload: &[u8],
) -> Option<Result<(Set, Json), RequestRefusal>>
pub fn decode_set( &self, group: &str, payload: &[u8], ) -> Option<Result<(Set, Json), RequestRefusal>>
A set/<group>’s query payload read as its Set<T>, with the
request’s JSON reading; None for a group with no set, which no
queryable answers (§2.4).
§Errors
The RequestRefusal.
Sourcepub fn encode_set(&self, group: &str, s: &Set) -> Result<Vec<u8>, WriteRefusal>
pub fn encode_set(&self, group: &str, s: &Set) -> Result<Vec<u8>, WriteRefusal>
A set/<group>’s query payload: CH, then Set<T>’s record.
§Errors
The packed writer’s refusal; packed::WriteRefusal::Unknown for a
group with no set.
Sourcepub fn decode_control(&self, payload: &[u8]) -> Result<Control, RequestRefusal>
pub fn decode_control(&self, payload: &[u8]) -> Result<Control, RequestRefusal>
Sourcepub fn encode_control(&self, c: &Control) -> Result<Vec<u8>, WriteRefusal>
pub fn encode_control(&self, c: &Control) -> Result<Vec<u8>, WriteRefusal>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Interface
impl Freeze for Interfacewhere
*const u8 is !null: Freeze,
PhantomData<Entry>: Freeze,
PhantomData<(String, TypeDecl)>: Freeze,
*const LeafNode<String, Layout> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Layout)>>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
impl Move for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnsafeUnpin for Interfacewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Entry>: UnsafeUnpin,
PhantomData<(String, TypeDecl)>: UnsafeUnpin,
*const LeafNode<String, Layout> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Layout)>>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
impl UnwindSafe for Interfacewhere
RawVecInner: UnwindSafe,
&'static str: UnwindSafe,
BTreeMap<String, Layout>: UnwindSafe,
BTreeMap<String, String>: 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
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> 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> ⓘ
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> ⓘ
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