pub struct TimeBase64Generator { /* private fields */ }Expand description
A time-based ID generator that produces Base64-encoded timestamps.
This generator encodes the current timestamp in milliseconds since UNIX epoch as a URL-safe Base64 string without padding. Optionally, it can prefix the ID with a static string for better readability or namespacing.
§Example
use rust_mcp_extra::{id_generator::TimeBase64Generator, IdGenerator};
let generator = TimeBase64Generator::new(Some("ts_"));
let id: String = generator.generate();
println!("Generated time-based ID: {}", id);Implementations§
Trait Implementations§
Source§impl<T> IdGenerator<T> for TimeBase64Generator
impl<T> IdGenerator<T> for TimeBase64Generator
Auto Trait Implementations§
impl Freeze for TimeBase64Generator
impl RefUnwindSafe for TimeBase64Generator
impl Send for TimeBase64Generator
impl Sync for TimeBase64Generator
impl Unpin for TimeBase64Generator
impl UnsafeUnpin for TimeBase64Generator
impl UnwindSafe for TimeBase64Generator
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