Struct ResumeToken
pub struct ResumeToken(/* private fields */);Expand description
Where the far side should resume a pull from, as the far side minted it.
Opaque: the caller stores it and hands it back, and never reads it (SY-15).
Text rather than bytes, because a token is what an HTTP peer puts in a query
string or a Durable Object in a cursor column, and because bytes would render
in JSON as an array of integers that no operator can read. It is the wire
form of a peer’s SyncPeer::Resume; turning one
into the other is the peer adapter’s, and nothing here assumes how.
§Examples
use happenstance_sync::wire::ResumeToken;
let token = ResumeToken::new("group:42");
assert_eq!(token.as_str(), "group:42");
assert_eq!(serde_json::to_string(&token)?, r#""group:42""#);Implementations§
Trait Implementations§
§impl Clone for ResumeToken
impl Clone for ResumeToken
§impl Debug for ResumeToken
impl Debug for ResumeToken
§impl<'de> Deserialize<'de> for ResumeToken
impl<'de> Deserialize<'de> for ResumeToken
§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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ResumeToken
§impl From<StoreResume> for ResumeToken
impl From<StoreResume> for ResumeToken
§fn from(resume: StoreResume) -> Self
fn from(resume: StoreResume) -> Self
Converts to this type from the input type.
§impl Hash for ResumeToken
impl Hash for ResumeToken
§impl PartialEq for ResumeToken
impl PartialEq for ResumeToken
§impl Serialize for ResumeToken
impl Serialize for ResumeToken
impl StructuralPartialEq for ResumeToken
§impl TryFrom<&ResumeToken> for StoreResume
Reads back the text From<StoreResume>
wrote, and nothing else.
impl TryFrom<&ResumeToken> for StoreResume
Reads back the text From<StoreResume>
wrote, and nothing else.
Strict, so the text form is one-to-one: digits only, no sign, no leading
zero but the start’s "0", and within u64.
§type Error = ForeignToken
type Error = ForeignToken
The type returned in the event of a conversion error.
§fn try_from(token: &ResumeToken) -> Result<Self, Self::Error>
fn try_from(token: &ResumeToken) -> Result<Self, Self::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for ResumeToken
impl RefUnwindSafe for ResumeToken
impl Send for ResumeToken
impl Sync for ResumeToken
impl Unpin for ResumeToken
impl UnsafeUnpin for ResumeToken
impl UnwindSafe for ResumeToken
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