pub struct Descriptor {
pub format: String,
pub service: String,
pub instance: String,
pub run: Option<String>,
pub catalog: Option<String>,
pub interfaces: Vec<InterfaceEntry>,
pub capabilities: Vec<String>,
pub requires: Vec<RequireEntry>,
pub profiles: Vec<String>,
pub meta: BTreeMap<String, Value>,
}Expand description
One instance’s descriptor.
Fields§
§format: Stringzk2-descriptor/0.1.
service: String<system>/<service>.
instance: StringThe instance id: 16 lowercase hex digits.
run: Option<String>The run the instance writes under now (core §3.3, §4.3), as its bytes
in lowercase hexadecimal: 4 digits for a 16-bit run, 8 for a 32-bit
one. An owner states it; a checker reads it as optional, so a
descriptor that states none is not D000, and any other spelling is
D002. Never null.
catalog: Option<String>The id of the deployment catalog the instance writes under (core
§3.3, §8.6), as 8 lowercase hex digits. An owner given a catalog
states it, and one with none leaves it out; a checker reads it as
optional, and any other spelling is D002. Never null.
interfaces: Vec<InterfaceEntry>The interfaces this instance implements.
capabilities: Vec<String>The capabilities this instance holds, naming the capability: gates
of its contracts. Written only when one is held: absent is none
(§3.3).
requires: Vec<RequireEntry>Every requirement, with its bindings as declared (R3). Written only when there is one: absent is none.
profiles: Vec<String>The profiles this instance follows, as <name>.v<major>. Written
only when it follows one: absent is none.
meta: BTreeMap<String, Value>Host, process, build: informative, never interpreted. zid is the
owner’s session zid, which an owner SHOULD state: a tool attributes
a state stamp to the owner by it (§3.3, 0.10; S1). Written only when
it holds a member.
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn size_of(&self, served: &[u8]) -> Size
pub fn size_of(&self, served: &[u8]) -> Size
The size of served, the document this descriptor’s owner put and
answers, as the owner wrote it (core §3.3): its count of bytes, and
the rest, which is that count less each of interfaces,
capabilities, requires and profiles the descriptor states.
A member is counted from the opening quote of its name to the last
byte of its value, and one comma with it. A member taken out of an
object that keeps another takes exactly one comma with it, wherever
it stands, and format, service and instance are always
written. So the rest is exact for the compact form the reference
writes, every empty member left out. A member’s value is counted
as it serializes here, so the rest of a document its owner spaced
otherwise counts that member’s spacing too.
Nothing here can fail: a value that does not serialize counts for nothing, and the rest never falls below 0.
Sourcepub fn size(&self) -> Result<Size, Error>
pub fn size(&self) -> Result<Size, Error>
This descriptor’s size as it serializes here (Descriptor::size_of
over its compact JSON, every empty member left out): what an owner
that has not written it yet would serve.
§Errors
The descriptor does not serialize.
Sourcepub fn stated_run(&self) -> Option<Run>
pub fn stated_run(&self) -> Option<Run>
The run the descriptor states (core §3.3), None when it states
none or spells it otherwise than 4 or 8 lowercase hex digits (D002).
Sourcepub fn stated_catalog(&self) -> Option<CatalogId>
pub fn stated_catalog(&self) -> Option<CatalogId>
The catalog the descriptor names (core §3.3, §8.6), None when it
names none or spells it otherwise than 8 lowercase hex digits (D002).
Sourcepub fn exposed<'c>(&self, contract: &'c Contract) -> Option<Vec<&'c Resource>>
pub fn exposed<'c>(&self, contract: &'c Contract) -> Option<Vec<&'c Resource>>
The resources of contract this instance exposes (§3.3): the
contract’s, minus the optional ones gated on a capability it does not
hold, minus those its entry lists unavailable; none at all when the
entry marks the interface "standby": true (§3.3, §6, 0.39), whose
unavailable says what it will expose once it serves. None when it
lists no entry for the contract’s interface.
What a tool decides a split-brain from, beside replicated serving
(§6, 0.7, #660). The entry’s revision is the caller’s to match: this
reads contract as given.
Trait Implementations§
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§impl Debug for Descriptor
impl Debug for Descriptor
Source§impl<'de> Deserialize<'de> for Descriptor
impl<'de> Deserialize<'de> for Descriptor
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>,
Source§impl JsonSchema for Descriptor
impl JsonSchema for Descriptor
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for Descriptor
impl PartialEq for Descriptor
Source§impl Serialize for Descriptor
impl Serialize for Descriptor
impl StructuralPartialEq for Descriptor
Auto Trait Implementations§
impl Forget for Descriptor
impl Freeze for Descriptorwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<InterfaceEntry>: Freeze,
PhantomData<String>: Freeze,
PhantomData<RequireEntry>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for Descriptor
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnsafeUnpin for Descriptorwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<InterfaceEntry>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<RequireEntry>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for Descriptorwhere
RawVecInner: UnwindSafe,
BTreeMap<String, u64>: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
BTreeMap<String, Value>: 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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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