pub struct PageToken(/* private fields */);Expand description
The engine’s own resume token: one plugin cursor per source stream, opaque to the caller exactly as a plugin’s cursor is opaque to the engine.
Rendered as lower-case hex, which is not obfuscation — the inside is not a secret — but the one property a token a person copies off a terminal has to have: it survives a shell. The document underneath holds a plugin’s own cursor, and a cursor may hold anything at all, so a token spelled as the raw JSON would carry quotes, braces and spaces straight into the next command line. Hex has no character a shell reads.
§What a token is and is not checked for
Both ways in go through parse — including deserialising one — and
what that establishes is structural: the string is hex, the bytes are this
engine’s own resume document, and every state in it is well formed. It does not, and
cannot, establish that this engine is the one that wrote it. A token is not a
credential and carries nothing secret; forging one buys a caller nothing they could
not have asked for outright, since every cursor inside is handed straight back to the
source that issued it and is validated there.
What a forged token could do is name a stream this configuration has no source for,
or resume further into a page than the engine ever pages. Both are refused where the
token meets the query it is resuming, by
Engine — see EngineError::Token — because only the engine knows
which sources are configured and what page ceiling each declares.
Implementations§
Source§impl PageToken
impl PageToken
Sourcepub fn parse(raw: impl Into<String>) -> Result<Self, SourceError>
pub fn parse(raw: impl Into<String>) -> Result<Self, SourceError>
Accept a token from a caller — a --page argument, or a deserialised response —
refusing anything that is not this engine’s own resume document.
Structural only, deliberately: see the type’s own note for what this establishes
and what Engine checks instead.
§Errors
Returns SourceError::Malformed when raw is not hex, is not this engine’s
document, or holds a state that is not well formed.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PageToken
impl<'de> Deserialize<'de> for PageToken
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>,
impl Eq for PageToken
Source§impl From<PageToken> for String
A token is its string, so serialising one is that string and nothing else — the
checking all happens on the way in, where a caller’s input is.
impl From<PageToken> for String
A token is its string, so serialising one is that string and nothing else — the checking all happens on the way in, where a caller’s input is.
Source§impl JsonSchema for PageToken
impl JsonSchema for PageToken
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 moreimpl StructuralPartialEq for PageToken
Auto Trait Implementations§
impl Freeze for PageToken
impl RefUnwindSafe for PageToken
impl Send for PageToken
impl Sync for PageToken
impl Unpin for PageToken
impl UnsafeUnpin for PageToken
impl UnwindSafe for PageToken
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.