pub struct RecordReader<'a> { /* private fields */ }Expand description
What:
A field reader over one untrusted record object,
naming the record in failures.
Why:
The incumbent’s createRecordReader:
each accessor fails closed with
“Transaction record
In TS you’d write (pseudocode):
type RecordReader = { string(key): string; ... };Implementations§
Source§impl<'a> RecordReader<'a>
Typed accessors,
each failing closed with the field named.
impl<'a> RecordReader<'a>
Typed accessors, each failing closed with the field named.
Sourcepub fn new(name: &str, map: &'a Map<String, Value>) -> Self
pub fn new(name: &str, map: &'a Map<String, Value>) -> Self
What:
A reader over a parsed object.
Why:
Nested objects get their own reader with a #-joined name.
In TS you’d write (pseudocode):
createRecordReader({ name, value })Sourcepub fn malformed(&self, key: &str) -> RecoveryError
pub fn malformed(&self, key: &str) -> RecoveryError
What: The malformed-field failure. Why: Every accessor reports the same sentence.
In TS you’d write (pseudocode):
malformed(key)Sourcepub fn string(&self, key: &str) -> Result<String, RecoveryError>
pub fn string(&self, key: &str) -> Result<String, RecoveryError>
What:
A required text field;
any text,
empty included,
as typeof === 'string'.
Why:
The incumbent’s readString.
In TS you’d write (pseudocode):
read.string(key)Sourcepub fn optional_string(
&self,
key: &str,
) -> Result<Option<String>, RecoveryError>
pub fn optional_string( &self, key: &str, ) -> Result<Option<String>, RecoveryError>
What:
An optional text field:
absent is None,
present must be text.
Why:
The incumbent’s optionalString (key in value).
In TS you’d write (pseudocode):
read.optionalString(key)Sourcepub fn boolean(&self, key: &str) -> Result<bool, RecoveryError>
pub fn boolean(&self, key: &str) -> Result<bool, RecoveryError>
What:
A required boolean field.
Why:
The incumbent’s boolean.
In TS you’d write (pseudocode):
read.boolean(key)Sourcepub fn positive_integer(&self, key: &str) -> Result<i64, RecoveryError>
pub fn positive_integer(&self, key: &str) -> Result<i64, RecoveryError>
What:
A required safe integer of at least 1.
Why:
The incumbent’s positiveInteger.
In TS you’d write (pseudocode):
read.positiveInteger(key)Sourcepub fn strings(&self, key: &str) -> Result<Vec<String>, RecoveryError>
pub fn strings(&self, key: &str) -> Result<Vec<String>, RecoveryError>
What:
A required array of text.
Why:
The incumbent’s strings.
In TS you’d write (pseudocode):
read.strings(key)Sourcepub fn path(&self, key: &str, bytes_key: &str) -> Result<Vec<u8>, RecoveryError>
pub fn path(&self, key: &str, bytes_key: &str) -> Result<Vec<u8>, RecoveryError>
What:
A required text field that names a path,
with the exact bytes from bytes_key when the record has them.
Why:
A name that is not UTF-8 is stored as its readable text and, beside it, the base64 of its bytes;
a record written by the incumbent has only the text, which is then the exact name.
Bytes whose readable text differs from the text field are a damaged record.
In TS you’d write (pseudocode):
read.path(key, bytesKey)Sourcepub fn paths(
&self,
key: &str,
bytes_key: &str,
) -> Result<Vec<Vec<u8>>, RecoveryError>
pub fn paths( &self, key: &str, bytes_key: &str, ) -> Result<Vec<Vec<u8>>, RecoveryError>
What:
A required array of text that names paths,
with the exact bytes of every path from bytes_key when the record has them.
Why:
See path;
the two arrays line up entry for entry.
In TS you’d write (pseudocode):
read.paths(key, bytesKey)Sourcepub fn object(&self, key: &str) -> Result<RecordReader<'a>, RecoveryError>
pub fn object(&self, key: &str) -> Result<RecordReader<'a>, RecoveryError>
What:
A required nested object,
as its own reader.
Why:
The incumbent’s object;
arrays and null are not objects here.
In TS you’d write (pseudocode):
read.object(key)Sourcepub fn base(&self, key: &str) -> Result<Base, RecoveryError>
pub fn base(&self, key: &str) -> Result<Base, RecoveryError>
What:
A required base.
Why:
The incumbent’s base:
unborn,
or commit with an oid.
In TS you’d write (pseudocode):
read.base(key)Sourcepub fn identity(&self, key: &str) -> Result<FileIdentity, RecoveryError>
pub fn identity(&self, key: &str) -> Result<FileIdentity, RecoveryError>
What:
A required file identity.
Why:
The incumbent’s identity.
In TS you’d write (pseudocode):
read.identity(key)Sourcepub fn optional_digest(
&self,
key: &str,
) -> Result<Option<ContentDigest>, RecoveryError>
pub fn optional_digest( &self, key: &str, ) -> Result<Option<ContentDigest>, RecoveryError>
What:
An optional content digest of an index snapshot:
absent is None,
present must be { "length": <whole number>, "fnv1a64": <16 lowercase hexadecimal digits> }.
Why:
Records written before the digests existed have none and keep their old trust in the artifact identity;
a digest that is present but misspelled is a damaged record and never read as absent.
In TS you’d write (pseudocode):
read.optionalDigest(key)Sourcepub fn lock(&self, key: &str) -> Result<LockIdentity, RecoveryError>
pub fn lock(&self, key: &str) -> Result<LockIdentity, RecoveryError>
What:
A required lock identity.
Why:
The incumbent’s lock.
In TS you’d write (pseudocode):
read.lock(key)Sourcepub fn added_paths(&self, key: &str) -> Result<Vec<AddedPath>, RecoveryError>
pub fn added_paths(&self, key: &str) -> Result<Vec<AddedPath>, RecoveryError>
What:
A required list of added-path records.
Why:
The incumbent’s addedPaths:
each item an object with a regular or executable mode.
In TS you’d write (pseudocode):
read.addedPaths(key)Auto Trait Implementations§
impl<'a> Freeze for RecordReader<'a>
impl<'a> RefUnwindSafe for RecordReader<'a>
impl<'a> Send for RecordReader<'a>
impl<'a> Sync for RecordReader<'a>
impl<'a> Unpin for RecordReader<'a>
impl<'a> UnsafeUnpin for RecordReader<'a>
impl<'a> UnwindSafe for RecordReader<'a>
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more