pub struct DateTimeWrapper(pub OffsetDateTime);Expand description
Wrapper for OffsetDateTime with serde support and validation
Ensures timestamps are valid and in the correct format for C2PA manifests.
Tuple Fields§
§0: OffsetDateTimeImplementations§
Source§impl DateTimeWrapper
impl DateTimeWrapper
Sourcepub fn now_utc() -> Self
pub fn now_utc() -> Self
Create new with current UTC time
§Example
use atlas_common::c2pa::DateTimeWrapper;
let now = DateTimeWrapper::now_utc();
println!("Current time: {}", now.to_rfc3339());Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate that the datetime is reasonable
Checks that:
- The date is after January 1, 1970
- The date is not in the future
§Errors
Returns an error if validation fails.
Sourcepub fn to_rfc3339(&self) -> String
pub fn to_rfc3339(&self) -> String
Get as RFC3339 string
Returns the datetime formatted according to RFC3339 standard.
Trait Implementations§
Source§impl Clone for DateTimeWrapper
impl Clone for DateTimeWrapper
Source§fn clone(&self) -> DateTimeWrapper
fn clone(&self) -> DateTimeWrapper
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DateTimeWrapper
impl Debug for DateTimeWrapper
Source§impl Default for DateTimeWrapper
impl Default for DateTimeWrapper
Source§impl<'de> Deserialize<'de> for DateTimeWrapper
impl<'de> Deserialize<'de> for DateTimeWrapper
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 DateTimeWrapper
impl Display for DateTimeWrapper
impl Eq for DateTimeWrapper
Source§impl PartialEq for DateTimeWrapper
impl PartialEq for DateTimeWrapper
Source§impl Serialize for DateTimeWrapper
impl Serialize for DateTimeWrapper
impl StructuralPartialEq for DateTimeWrapper
Auto Trait Implementations§
impl Freeze for DateTimeWrapper
impl RefUnwindSafe for DateTimeWrapper
impl Send for DateTimeWrapper
impl Sync for DateTimeWrapper
impl Unpin for DateTimeWrapper
impl UnsafeUnpin for DateTimeWrapper
impl UnwindSafe for DateTimeWrapper
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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