pub struct BucketLocation {
pub bucket_type: BucketType,
pub base_id: Id,
pub duration: DurationMillis,
pub bucket_time_millis: TimeMillis,
pub location_id: Id,
}Fields§
§bucket_type: BucketType§base_id: Id§duration: DurationMillis§bucket_time_millis: TimeMillis§location_id: IdImplementations§
Source§impl BucketLocation
impl BucketLocation
pub fn round_down_to_bucket_start( timestamp: TimeMillis, duration: DurationMillis, ) -> TimeMillis
pub fn new( bucket_type: BucketType, base_id: Id, duration: DurationMillis, timestamp: TimeMillis, ) -> Result<Self>
pub fn get_hash_for_signing(&self) -> Hash
pub fn validate(&self) -> Result<()>
Sourcepub fn to_html_attr(&self) -> String
pub fn to_html_attr(&self) -> String
Serialise to a versioned, tilde-delimited string safe for use as an HTML attribute value or URL segment.
Format: {version}~{bucket_type}~{base_id_hex}~{duration}~{bucket_time_millis}
Example: 1~User~aabb...cc~1D~20240115.123045.000
location_id is omitted — it is recomputed from the other fields on deserialisation.
Future versions may append additional tilde-separated fields; readers must ignore unknown fields.
Sourcepub fn from_html_attr(s: &str) -> Result<Self>
pub fn from_html_attr(s: &str) -> Result<Self>
Deserialise from the format produced by BucketLocation::to_html_attr.
Trait Implementations§
Source§impl Clone for BucketLocation
impl Clone for BucketLocation
Source§fn clone(&self) -> BucketLocation
fn clone(&self) -> BucketLocation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BucketLocation
impl Debug for BucketLocation
Source§impl<'de> Deserialize<'de> for BucketLocation
impl<'de> Deserialize<'de> for BucketLocation
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for BucketLocation
impl Display for BucketLocation
Source§impl PartialEq for BucketLocation
impl PartialEq for BucketLocation
Source§impl Serialize for BucketLocation
impl Serialize for BucketLocation
impl StructuralPartialEq for BucketLocation
Auto Trait Implementations§
impl Freeze for BucketLocation
impl RefUnwindSafe for BucketLocation
impl Send for BucketLocation
impl Sync for BucketLocation
impl Unpin for BucketLocation
impl UnsafeUnpin for BucketLocation
impl UnwindSafe for BucketLocation
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.