Struct persistent_time::Time
[−]
[src]
pub struct Time { /* fields omitted */ }
Methods
impl Time
[src]
fn new() -> Self
Methods from Deref<Target = DateTime<Local>>
fn date(&self) -> Date<Tz>
Retrieves a date component.
fn time(&self) -> NaiveTime
Retrieves a time component.
Unlike date
, this is not associated to the time zone.
fn timestamp(&self) -> i64
Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka "UNIX timestamp").
fn timestamp_subsec_millis(&self) -> u32
Returns the number of milliseconds since the last second boundary
warning: in event of a leap second, this may exceed 999
note: this is not the number of milliseconds since January 1, 1970 0:00:00 UTC
fn timestamp_subsec_micros(&self) -> u32
Returns the number of microseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999
note: this is not the number of microseconds since January 1, 1970 0:00:00 UTC
fn timestamp_subsec_nanos(&self) -> u32
Returns the number of nanoseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999_999
note: this is not the number of nanoseconds since January 1, 1970 0:00:00 UTC
fn num_seconds_from_unix_epoch(&self) -> i64
Deprecated: Same to DateTime::timestamp
.
fn offset(&'a self) -> &'a <Tz as TimeZone>::Offset
Retrieves an associated offset from UTC.
fn timezone(&self) -> Tz
Retrieves an associated time zone.
fn with_timezone<Tz2>(&self, tz: &Tz2) -> DateTime<Tz2> where
Tz2: TimeZone,
Tz2: TimeZone,
Changes the associated time zone.
This does not change the actual DateTime
(but will change the string representation).
fn checked_add(self, rhs: Duration) -> Option<DateTime<Tz>>
Adds given Duration
to the current date and time.
Returns None
when it will result in overflow.
fn checked_sub(self, rhs: Duration) -> Option<DateTime<Tz>>
Subtracts given Duration
from the current date and time.
Returns None
when it will result in overflow.
fn naive_utc(&self) -> NaiveDateTime
Returns a view to the naive UTC datetime.
fn naive_local(&self) -> NaiveDateTime
Returns a view to the naive local datetime.
fn to_rfc2822(&self) -> String
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
fn to_rfc3339(&self) -> String
Returns an RFC 3339 and ISO 8601 date and time string such as 1996-12-19T16:39:57-08:00
.
fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I> where
I: Iterator<Item = Item<'a>> + Clone,
I: Iterator<Item = Item<'a>> + Clone,
Formats the combined date and time with the specified formatting items.
fn format(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
Formats the combined date and time with the specified format string.
See the format::strftime
module
on the supported escape sequences.
Trait Implementations
impl Debug for Time
[src]
impl Copy for Time
[src]
impl Clone for Time
[src]
fn clone(&self) -> Time
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Time
[src]
fn eq(&self, __arg_0: &Time) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Time) -> bool
This method tests for !=
.
impl Eq for Time
[src]
impl Deref for Time
[src]
type Target = DateTime<Local>
The resulting type after dereferencing
fn deref(&self) -> &DateTime<Local>
The method called to dereference a value
impl Encodable for Time
[src]
impl Decodable for Time
[src]
impl FromSql for Time
[src]
fn from_sql<R: Read>(ty: &Type, raw: &mut R, ctx: &SessionInfo) -> Result<Time>
Creates a new value of this type from a Read
er of the binary format of the specified Postgres Type
. Read more
fn accepts(_: &Type) -> bool
Determines if a value of this type can be created from the specified Postgres Type
. Read more
fn from_sql_null(ty: &Type, ctx: &SessionInfo) -> Result<Self, Error>
Creates a new value of this type from a NULL
SQL value. Read more
impl ToSql for Time
[src]
fn to_sql<W: Write + ?Sized>(
&self,
ty: &Type,
w: &mut W,
ctx: &SessionInfo
) -> Result<IsNull>
&self,
ty: &Type,
w: &mut W,
ctx: &SessionInfo
) -> Result<IsNull>
Converts the value of self
into the binary format of the specified Postgres Type
, writing it to out
. Read more
fn accepts(_: &Type) -> bool
Determines if a value of this type can be converted to the specified Postgres Type
. Read more
fn to_sql_checked(
&self,
ty: &Type,
out: &mut Write,
ctx: &SessionInfo
) -> Result<IsNull>
&self,
ty: &Type,
out: &mut Write,
ctx: &SessionInfo
) -> Result<IsNull>
An adaptor method used internally by Rust-Postgres. Read more
impl ToRedisArgs for Time
[src]
fn to_redis_args(&self) -> Vec<Vec<u8>>
This converts the value into a vector of bytes. Each item is a single argument. Most items generate a vector of a single item. Read more
fn describe_numeric_behavior(&self) -> NumericBehavior
Returns an information about the contained value with regards to it's numeric behavior in a redis context. This is used in some high level concepts to switch between different implementations of redis functions (for instance INCR
vs INCRBYFLOAT
). Read more
fn is_single_arg(&self) -> bool
Returns an indiciation if the value contained is exactly one argument. It returns false if it's zero or more than one. This is used in some high level functions to intelligently switch between GET
and MGET
variants. Read more
impl FromRedisValue for Time
[src]
fn from_redis_value(v: &Value) -> RedisResult<Self>
Given a redis Value
this attempts to convert it into the given destination type. If that fails because it's not compatible an appropriate error is generated. Read more
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
Similar to from_redis_value
but constructs a vector of objects from another vector of values. This primarily exists internally to customize the behavior for vectors of tuples. Read more