Skip to main content

Timestamp

Struct Timestamp 

Source
pub struct Timestamp {
    pub seconds: i64,
    pub nanos: i32,
}
Expand description

A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution.

The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one.

All minutes are 60 seconds long. Leap seconds are “smeared” so that no leap second table is needed for interpretation, using a 24-hour linear smear.

The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings.

§Examples

Example 1: Compute Timestamp from POSIX time().

Timestamp timestamp;
timestamp.set_seconds(time(NULL));
timestamp.set_nanos(0);

Example 2: Compute Timestamp from POSIX gettimeofday().

struct timeval tv;
gettimeofday(&tv, NULL);

Timestamp timestamp;
timestamp.set_seconds(tv.tv_sec);
timestamp.set_nanos(tv.tv_usec * 1000);

Example 3: Compute Timestamp from Win32 GetSystemTimeAsFileTime().

FILETIME ft;
GetSystemTimeAsFileTime(&ft);
UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;

// A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
Timestamp timestamp;
timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));

Example 4: Compute Timestamp from Java System.currentTimeMillis().

long millis = System.currentTimeMillis();

Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
     .setNanos((int) ((millis % 1000) * 1000000)).build();

Example 5: Compute Timestamp from Java Instant.now().

Instant now = Instant.now();

Timestamp timestamp =
     Timestamp.newBuilder().setSeconds(now.getEpochSecond())
         .setNanos(now.getNano()).build();

Example 6: Compute Timestamp from current time in Python.

timestamp = Timestamp()
timestamp.GetCurrentTime()

§JSON Mapping

In JSON format, the Timestamp type is encoded as a string in the RFC 3339 format. That is, the format is “{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z” where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The “Z” suffix indicates the timezone (“UTC”); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by “Z”) when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset).

For example, “2017-01-15T01:30:15.01Z” encodes 15.01 seconds past 01:30 UTC on January 15, 2017.

In JavaScript, one can convert a Date object to this format using the standard toISOString() method. In Python, a standard datetime.datetime object can be converted to this format using strftime with the time format spec ‘%Y-%m-%dT%H:%M:%S.%fZ’. Likewise, in Java, one can use the Joda Time’s ISODateTimeFormat.dateTime() to obtain a formatter capable of generating timestamps in this format.

Fields§

§seconds: i64

Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.

§nanos: i32

Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.

Implementations§

Source§

impl Timestamp

Source

pub fn format(&self, string: &str) -> Result<String, TimestampError>

Available on crate feature chrono only.

Converts this timestamp into a chrono::DateTime<Utc> struct and calls .format on it with the string argument being given.

Source

pub fn as_datetime_utc(&self) -> Result<DateTime<Utc>, TimestampError>

Available on crate feature chrono only.

Converts this Timestamp instance to chrono::DateTime with chrono::Utc.

Source§

impl Timestamp

Source

pub const fn new(seconds: i64, nanos: i32) -> Self

Creates a new instance.

Source§

impl Timestamp

Source

pub fn now() -> Self

Available on crate feature std only.

Returns the current timestamp.

Source§

impl Timestamp

Source

pub fn is_within_range_from_now(&self, range: Duration) -> bool

Available on crate features std or chrono-wasm only.

Checks whether the Timestamp instance is within the indicated range (positive or negative) from now.

Source

pub fn is_within_future_range(&self, range: Duration) -> bool

Available on crate features std or chrono-wasm only.

Checks whether the Timestamp instance is within the indicated range in the future.

Source

pub fn is_within_past_range(&self, range: Duration) -> bool

Available on crate features std or chrono-wasm only.

Checks whether the Timestamp instance is within the indicated range in the past.

Source

pub fn is_future(&self) -> bool

Available on crate features std or chrono-wasm only.

Returns true if the timestamp is in the future.

Source

pub fn is_past(&self) -> bool

Available on crate features std or chrono-wasm only.

Returns true if the timestamp is in the past.

Source§

impl Timestamp

Source

pub fn normalize(&mut self)

Normalizes the timestamp to a canonical format.

Based on google::protobuf::util::CreateNormalized.

Source

pub fn try_normalize(self) -> Result<Self, Self>

Normalizes the timestamp to a canonical format, returning the original value if it cannot be normalized.

Normalization is based on google::protobuf::util::CreateNormalized.

Source

pub fn normalized(&self) -> Self

Return a normalized copy of the timestamp to a canonical format.

Based on google::protobuf::util::CreateNormalized.

Source

pub fn date(year: i64, month: u8, day: u8) -> Result<Self, TimestampError>

Creates a new Timestamp at the start of the provided UTC date.

Source

pub fn date_time( year: i64, month: u8, day: u8, hour: u8, minute: u8, second: u8, ) -> Result<Self, TimestampError>

Creates a new Timestamp instance with the provided UTC date and time.

Source

pub fn date_time_nanos( year: i64, month: u8, day: u8, hour: u8, minute: u8, second: u8, nanos: u32, ) -> Result<Self, TimestampError>

Creates a new Timestamp instance with the provided UTC date and time.

Trait Implementations§

Source§

impl<'b> Add<&'b Duration> for &Timestamp

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b Duration) -> Self::Output

Performs the + operation. Read more
Source§

impl<'b> Add<&'b Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b Duration) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Duration> for &Timestamp

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: StdDuration) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<TimeDelta> for Timestamp

Available on crate feature chrono only.
Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

fn add(self, rhs: TimeDelta) -> Self::Output

Performs the + operation. Read more
Source§

impl<'__expr> AsExpression<Datetime> for &'__expr Timestamp

Source§

type Expression = Bound<Datetime, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Datetime>>::Expression

Perform the conversion
Source§

impl AsExpression<Datetime> for Timestamp

Source§

type Expression = Bound<Datetime, Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Datetime>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Nullable<Datetime>> for &'__expr Timestamp

Source§

type Expression = Bound<Nullable<Datetime>, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Nullable<Datetime>>>::Expression

Perform the conversion
Source§

impl AsExpression<Nullable<Datetime>> for Timestamp

Source§

type Expression = Bound<Nullable<Datetime>, Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Nullable<Datetime>>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Nullable<Timestamp>> for &'__expr Timestamp

Source§

type Expression = Bound<Nullable<Timestamp>, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<Timestamp>>>::Expression

Perform the conversion
Source§

impl AsExpression<Nullable<Timestamp>> for Timestamp

Source§

type Expression = Bound<Nullable<Timestamp>, Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<Timestamp>>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Nullable<Timestamptz>> for &'__expr Timestamp

Source§

type Expression = Bound<Nullable<Timestamptz>, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<Timestamptz>>>::Expression

Perform the conversion
Source§

impl AsExpression<Nullable<Timestamptz>> for Timestamp

Source§

type Expression = Bound<Nullable<Timestamptz>, Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<Timestamptz>>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Nullable<Timestamptz>> for &'__expr Timestamp

Source§

type Expression = Bound<Nullable<Timestamptz>, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<TimestamptzSqlite>>>::Expression

Perform the conversion
Source§

impl AsExpression<Nullable<Timestamptz>> for Timestamp

Source§

type Expression = Bound<Nullable<Timestamptz>, Timestamp>

The expression being returned
Source§

fn as_expression( self, ) -> <Self as AsExpression<Nullable<TimestamptzSqlite>>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Timestamp> for &'__expr Timestamp

Source§

type Expression = Bound<Timestamp, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Timestamp>>::Expression

Perform the conversion
Source§

impl AsExpression<Timestamp> for Timestamp

Source§

type Expression = Bound<Timestamp, Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Timestamp>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Timestamptz> for &'__expr Timestamp

Source§

type Expression = Bound<Timestamptz, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Timestamptz>>::Expression

Perform the conversion
Source§

impl AsExpression<Timestamptz> for Timestamp

Source§

type Expression = Bound<Timestamptz, Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<Timestamptz>>::Expression

Perform the conversion
Source§

impl<'__expr> AsExpression<Timestamptz> for &'__expr Timestamp

Source§

type Expression = Bound<Timestamptz, &'__expr Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<TimestamptzSqlite>>::Expression

Perform the conversion
Source§

impl AsExpression<Timestamptz> for Timestamp

Source§

type Expression = Bound<Timestamptz, Timestamp>

The expression being returned
Source§

fn as_expression(self) -> <Self as AsExpression<TimestamptzSqlite>>::Expression

Perform the conversion
Source§

impl Clone for Timestamp

Source§

fn clone(&self) -> Timestamp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Timestamp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Timestamp

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Timestamp

Available on crate feature serde only.
Source§

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 Timestamp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<DateTime<Utc>> for Timestamp

Available on crate feature chrono only.
Source§

fn from(datetime: DateTime<Utc>) -> Self

Converts to this type from the input type.
Source§

impl From<NaiveDateTime> for Timestamp

Available on crate feature chrono only.
Source§

fn from(datetime: NaiveDateTime) -> Self

Converts to this type from the input type.
Source§

impl From<SystemTime> for Timestamp

Available on crate feature std only.
Source§

fn from(system_time: SystemTime) -> Self

Converts to this type from the input type.
Source§

impl FromSql<Datetime, Mysql> for Timestamp

Available on crate feature diesel-mysql and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(bytes: MysqlValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromSql<Timestamp, Mysql> for Timestamp

Available on crate feature diesel-mysql and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(bytes: MysqlValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromSql<Timestamp, Pg> for Timestamp

Available on crate feature diesel-postgres and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(bytes: PgValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromSql<Timestamp, Sqlite> for Timestamp

Available on crate feature diesel-sqlite and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(value: <Sqlite as Backend>::RawValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromSql<Timestamptz, Pg> for Timestamp

Available on crate feature diesel-postgres and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(bytes: PgValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromSql<Timestamptz, Sqlite> for Timestamp

Available on crate feature diesel-sqlite and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn from_sql(value: <Sqlite as Backend>::RawValue<'_>) -> DeserializeResult<Self>

See the trait documentation.
Source§

fn from_nullable_sql( bytes: Option<<DB as Backend>::RawValue<'_>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A specialized variant of from_sql for handling null values. Read more
Source§

impl FromStr for Timestamp

Source§

type Err = TimestampError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, TimestampError>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Timestamp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for Timestamp

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl Name for Timestamp

Source§

const PACKAGE: &'static str = PACKAGE_PREFIX

Package name this message type is contained in. They are domain-like and delimited by ., e.g. google.protobuf.
Source§

const NAME: &'static str = "Timestamp"

Simple name for this Message. This name is the same as it appears in the source .proto file, e.g. FooBar.
Source§

fn type_url() -> String

Type URL for this Message, which by default is the full name with a leading slash, but may also include a leading domain name, e.g. type.googleapis.com/google.profile.Person. This can be used when serializing into the google.protobuf.Any type.
Source§

fn full_name() -> String

Fully-qualified unique name for this Message. It’s prefixed with the package name and names of any parent messages, e.g. google.rpc.BadRequest.FieldViolation. By default, this is the package name followed by the message name. Fully-qualified names must be unique within a domain of Type URLs.
Source§

impl Ord for Timestamp

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Timestamp

Source§

fn eq(&self, other: &Timestamp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Timestamp

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl QueryId for Timestamp

Source§

const HAS_STATIC_QUERY_ID: bool = true

Can the SQL generated by Self be uniquely identified by its type? Read more
Source§

type QueryId = Timestamp

A type which uniquely represents Self in a SQL query. Read more
Source§

fn query_id() -> Option<TypeId>

Returns the type id of Self::QueryId if Self::HAS_STATIC_QUERY_ID. Returns None otherwise. Read more
Source§

impl<__DB, __ST> Queryable<__ST, __DB> for Timestamp
where __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,

Source§

type Row = Timestamp

The Rust type you’d like to map from. Read more
Source§

fn build(row: Self) -> Result<Self>

Construct an instance of this type
Source§

impl Serialize for Timestamp

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'b> Sub<&'b Duration> for &Timestamp

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b Duration) -> Self::Output

Performs the - operation. Read more
Source§

impl<'b> Sub<&'b Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b Duration) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<Duration> for &'a Timestamp

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: StdDuration) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Duration> for Timestamp

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<TimeDelta> for Timestamp

Available on crate feature chrono only.
Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: TimeDelta) -> Self::Output

Performs the - operation. Read more
Source§

impl ToSql<Datetime, Mysql> for Timestamp

Available on crate feature diesel-mysql and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Mysql>) -> SerializeResult

See the trait documentation.
Source§

impl<__DB> ToSql<Nullable<Datetime>, __DB> for Timestamp
where __DB: Backend, Self: ToSql<Datetime, __DB>,

Source§

fn to_sql<'__b>(&'__b self, out: &mut Output<'__b, '_, __DB>) -> Result

See the trait documentation.
Source§

impl<__DB> ToSql<Nullable<Timestamp>, __DB> for Timestamp
where __DB: Backend, Self: ToSql<Timestamp, __DB>,

Source§

fn to_sql<'__b>(&'__b self, out: &mut Output<'__b, '_, __DB>) -> Result

See the trait documentation.
Source§

impl<__DB> ToSql<Nullable<Timestamptz>, __DB> for Timestamp
where __DB: Backend, Self: ToSql<Timestamptz, __DB>,

Source§

fn to_sql<'__b>(&'__b self, out: &mut Output<'__b, '_, __DB>) -> Result

See the trait documentation.
Source§

impl<__DB> ToSql<Nullable<Timestamptz>, __DB> for Timestamp
where __DB: Backend, Self: ToSql<TimestamptzSqlite, __DB>,

Source§

fn to_sql<'__b>(&'__b self, out: &mut Output<'__b, '_, __DB>) -> Result

See the trait documentation.
Source§

impl ToSql<Timestamp, Mysql> for Timestamp

Available on crate feature diesel-mysql and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Mysql>) -> SerializeResult

See the trait documentation.
Source§

impl ToSql<Timestamp, Pg> for Timestamp

Available on crate feature diesel-postgres and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Pg>) -> SerializeResult

See the trait documentation.
Source§

impl ToSql<Timestamp, Sqlite> for Timestamp

Available on crate feature diesel-sqlite and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Sqlite>) -> SerializeResult

See the trait documentation.
Source§

impl ToSql<Timestamptz, Pg> for Timestamp

Available on crate feature diesel-postgres and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Pg>) -> SerializeResult

See the trait documentation.
Source§

impl ToSql<Timestamptz, Sqlite> for Timestamp

Available on crate feature diesel-sqlite and (crate features diesel-postgres or diesel-sqlite or diesel-mysql) only.
Source§

fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, Sqlite>) -> SerializeResult

See the trait documentation.
Source§

impl TryFrom<DateTime<FixedOffset>> for Timestamp

Available on crate feature chrono only.
Source§

type Error = TimestampError

The type returned in the event of a conversion error.
Source§

fn try_from(dt: DateTime<FixedOffset>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Timestamp> for DateTime<FixedOffset>

Available on crate feature chrono only.
Source§

type Error = TimestampError

The type returned in the event of a conversion error.
Source§

fn try_from(timestamp: Timestamp) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Timestamp> for DateTime<Utc>

Available on crate feature chrono only.
Source§

type Error = TimestampError

The type returned in the event of a conversion error.
Source§

fn try_from(timestamp: Timestamp) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Timestamp> for NaiveDateTime

Available on crate feature chrono only.
Source§

type Error = TimestampError

The type returned in the event of a conversion error.
Source§

fn try_from(timestamp: Timestamp) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Timestamp> for SystemTime

Available on crate feature std only.
Source§

type Error = TimestampError

The type returned in the event of a conversion error.
Source§

fn try_from(timestamp: Timestamp) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Timestamp> for Value

Available on crate features chrono and cel only.
Source§

type Error = CelConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(value: Timestamp) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Timestamp

Source§

impl Eq for Timestamp

Source§

impl StructuralPartialEq for Timestamp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> AsDebug for T
where T: Debug,

Source§

fn as_debug(&self) -> &dyn Debug

Returns self as a &dyn Debug trait object.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

fn coerce_mut_to(&mut self) -> &mut T

Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, ST, DB> FromSqlRow<ST, DB> for T
where T: Queryable<ST, DB>, ST: SqlTypeOrSelectable, DB: Backend, <T as Queryable<ST, DB>>::Row: FromStaticSqlRow<ST, DB>,

Source§

fn build_from_row<'a>( row: &impl Row<'a, DB>, ) -> Result<T, Box<dyn Error + Send + Sync>>

See the trait documentation.
Source§

impl<T, ST, DB> FromStaticSqlRow<ST, DB> for T
where DB: Backend, T: FromSql<ST, DB>, ST: SingleValue,

Source§

fn build_from_row<'a>( row: &impl Row<'a, DB>, ) -> Result<T, Box<dyn Error + Send + Sync>>

See the trait documentation
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
where ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,

Source§

const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE

The number of fields that this type will consume.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<T> TryIntoValue for T
where T: Serialize,

Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,