pub struct SuggestId { /* private fields */ }Expand description
Unique identifier for a suggestion coupled to AnalysisContext lifecycle
Uses (index, generation) design for stale detection.
Format: “S001g0”, “S042g3”, etc.
§Example
use ryo_suggest::SuggestId;
let id = SuggestId::new(1, 0);
assert_eq!(id.to_string(), "S001g0");
assert_eq!(id.index(), 1);
assert_eq!(id.generation(), 0);
let parsed: SuggestId = "S042g3".parse().unwrap();
assert_eq!(parsed.index(), 42);
assert_eq!(parsed.generation(), 3);Implementations§
Source§impl SuggestId
impl SuggestId
Sourcepub fn new(index: u32, generation: u32) -> SuggestId
pub fn new(index: u32, generation: u32) -> SuggestId
Create a new SuggestId with index and generation
Sourcepub fn generation(&self) -> u32
pub fn generation(&self) -> u32
Get the generation component
Sourcepub fn is_generation(&self, gen: u32) -> bool
pub fn is_generation(&self, gen: u32) -> bool
Check if this ID matches a given generation
Sourcepub fn with_generation(&self, generation: u32) -> SuggestId
pub fn with_generation(&self, generation: u32) -> SuggestId
Create a new ID with bumped generation
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SuggestId
impl<'de> Deserialize<'de> for SuggestId
Source§fn deserialize<D>(
deserializer: D,
) -> Result<SuggestId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SuggestId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for SuggestId
impl Ord for SuggestId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for SuggestId
impl PartialOrd for SuggestId
Source§impl Serialize for SuggestId
impl Serialize for SuggestId
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for SuggestId
impl Eq for SuggestId
impl StructuralPartialEq for SuggestId
Auto Trait Implementations§
impl Freeze for SuggestId
impl RefUnwindSafe for SuggestId
impl Send for SuggestId
impl Sync for SuggestId
impl Unpin for SuggestId
impl UnsafeUnpin for SuggestId
impl UnwindSafe for SuggestId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more