mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
time, date: Add missing docs.
This commit is contained in:
parent
2d7bf32ad4
commit
e1bd0086f1
2 changed files with 5 additions and 0 deletions
|
@ -16,14 +16,17 @@ use std::str::FromStr;
|
||||||
pub struct DateTime(ChronoDateTime<FixedOffset>);
|
pub struct DateTime(ChronoDateTime<FixedOffset>);
|
||||||
|
|
||||||
impl DateTime {
|
impl DateTime {
|
||||||
|
/// Retrieves the associated timezone.
|
||||||
pub fn timezone(&self) -> FixedOffset {
|
pub fn timezone(&self) -> FixedOffset {
|
||||||
self.0.timezone()
|
self.0.timezone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new `DateTime` with a different timezone.
|
||||||
pub fn with_timezone(&self, tz: &FixedOffset) -> DateTime {
|
pub fn with_timezone(&self, tz: &FixedOffset) -> DateTime {
|
||||||
DateTime(self.0.with_timezone(tz))
|
DateTime(self.0.with_timezone(tz))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Formats this `DateTime` with the specified format string.
|
||||||
pub fn format(&self, fmt: &str) -> String {
|
pub fn format(&self, fmt: &str) -> String {
|
||||||
format!("{}", self.0.format(fmt))
|
format!("{}", self.0.format(fmt))
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,13 @@ use std::convert::TryFrom;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
generate_empty_element!(
|
generate_empty_element!(
|
||||||
|
/// An entity time query.
|
||||||
TimeQuery, "time", TIME
|
TimeQuery, "time", TIME
|
||||||
);
|
);
|
||||||
|
|
||||||
impl IqGetPayload for TimeQuery {}
|
impl IqGetPayload for TimeQuery {}
|
||||||
|
|
||||||
|
/// An entity time result, containing an unique DateTime.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TimeResult(pub DateTime);
|
pub struct TimeResult(pub DateTime);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue