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 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 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
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 more