pub struct Compact {
pub index: u16,
pub resource: u8,
pub confirmed: bool,
}Expand description
The compact form’s fields (§4.4, “The compact attachment”).
Fields§
§index: u16The value’s revision, by its index in the archive’s catalog: 10 bits.
resource: u8The value’s resource, by its place among the revision’s resources in the canonical form’s order: 7 bits.
confirmed: boolImplementations§
Source§impl Compact
impl Compact
Sourcepub fn write(self) -> [u8; 3]
pub fn write(self) -> [u8; 3]
Its 3 bytes: index 10, resource 7, confirmed 1, extension 1 (0), reserved 5 (0), most significant bit first.
§Panics
If the index is past 1,023 or the resource past 127, which no catalog and no compact attachment holds.
Sourcepub fn read(bytes: &[u8]) -> Result<Compact, Refusal>
pub fn read(bytes: &[u8]) -> Result<Compact, Refusal>
Reads the 3 bytes of a compact attachment: its fields, or the first two refusals, which leave nothing read.
§Errors
Refusal::Extension or Refusal::Reserved.
§Panics
If bytes is not 3 bytes long: any other length is the JSON form.
Trait Implementations§
impl Copy for Compact
impl Eq for Compact
impl StructuralPartialEq for Compact
Auto Trait Implementations§
impl Forget for Compact
impl Freeze for Compact
impl Move for Compact
impl RefUnwindSafe for Compact
impl Send for Compact
impl Sync for Compact
impl Unpin for Compact
impl UnsafeUnpin for Compact
impl UnwindSafe for Compact
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