Struct gstreamer::DateTime[][src]

pub struct DateTime(_);

Struct to store date, time and timezone information altogether. crate::DateTime is refcounted and immutable.

Date information is handled using the proleptic Gregorian calendar.

Provides basic creation functions and accessor functions to its fields.

Implementations

impl DateTime[src]

pub fn from_g_date_time(dt: &DateTime) -> DateTime[src]

pub fn from_iso8601_string(string: &str) -> Result<DateTime, BoolError>[src]

pub fn from_unix_epoch_local_time(secs: i64) -> Result<DateTime, BoolError>[src]

pub fn from_unix_epoch_local_time_usecs(
    usecs: i64
) -> Result<DateTime, BoolError>
[src]

This is supported on crate feature v1_18 only.

pub fn from_unix_epoch_utc(secs: i64) -> Result<DateTime, BoolError>[src]

pub fn from_unix_epoch_utc_usecs(usecs: i64) -> Result<DateTime, BoolError>[src]

This is supported on crate feature v1_18 only.

pub fn new_now_local_time() -> DateTime[src]

Creates a new crate::DateTime representing the current date and time.

Free-function: gst_date_time_unref

Returns

the newly created crate::DateTime which should be freed with [Self::unref()].

pub fn new_now_utc() -> DateTime[src]

Creates a new crate::DateTime that represents the current instant at Universal coordinated time.

Free-function: gst_date_time_unref

Returns

the newly created crate::DateTime which should be freed with [Self::unref()].

pub fn year(&self) -> i32[src]

pub fn has_day(&self) -> bool[src]

Returns

true if self’s day field is set, otherwise false

pub fn has_month(&self) -> bool[src]

Returns

true if self’s month field is set, otherwise false

pub fn has_second(&self) -> bool[src]

Returns

true if self’s second field is set, otherwise false

pub fn has_time(&self) -> bool[src]

Returns

true if self’s hour and minute fields are set, otherwise false

pub fn has_year(&self) -> bool[src]

Returns

true if self’s year field is set (which should always be the case), otherwise false

pub fn to_g_date_time(&self) -> Result<DateTime, BoolError>[src]

Creates a new crate::glib::DateTime from a fully defined crate::DateTime object.

Free-function: g_date_time_unref

Returns

a newly created crate::glib::DateTime, or None on error

pub fn to_iso8601_string(&self) -> Result<GString, BoolError>[src]

Create a minimal string compatible with ISO-8601. Possible output formats are (for example): 2012, 2012-06, 2012-06-23, 2012-06-23T23:30Z, 2012-06-23T23:30+0100, 2012-06-23T23:30:59Z, 2012-06-23T23:30:59+0100

Returns

a newly allocated string formatted according to ISO 8601 and only including the datetime fields that are valid, or None in case there was an error. The string should be freed with g_free().

impl DateTime[src]

pub fn new<TZ: Into<Option<f32>>, Y: Into<i32>, MO: Into<Option<i32>>, D: Into<Option<i32>>, H: Into<Option<i32>>, MI: Into<Option<i32>>, S: Into<Option<f64>>>(
    tzoffset: TZ,
    year: Y,
    month: MO,
    day: D,
    hour: H,
    minute: MI,
    seconds: S
) -> Result<DateTime, BoolError>
[src]

Creates a new crate::DateTime using the date and times in the gregorian calendar in the supplied timezone.

year should be from 1 to 9999, month should be from 1 to 12, day from 1 to 31, hour from 0 to 23, minutes and seconds from 0 to 59.

Note that tzoffset is a float and was chosen so for being able to handle some fractional timezones, while it still keeps the readability of representing it in hours for most timezones.

If value is -1 then all over value will be ignored. For example if month == -1, then crate::DateTime will created only for year. If day == -1, then crate::DateTime will created for year and month and so on.

Free-function: gst_date_time_unref

tzoffset

Offset from UTC in hours.

year

the gregorian year

month

the gregorian month

day

the day of the gregorian month

hour

the hour of the day

minute

the minute of the hour

seconds

the second of the minute

Returns

the newly created crate::DateTime

pub fn new_local_time<Y: Into<i32>, MO: Into<Option<i32>>, D: Into<Option<i32>>, H: Into<Option<i32>>, MI: Into<Option<i32>>, S: Into<Option<f64>>>(
    year: Y,
    month: MO,
    day: D,
    hour: H,
    minute: MI,
    seconds: S
) -> Result<DateTime, BoolError>
[src]

Creates a new crate::DateTime using the date and times in the gregorian calendar in the local timezone.

year should be from 1 to 9999, month should be from 1 to 12, day from 1 to 31, hour from 0 to 23, minutes and seconds from 0 to 59.

If month is -1, then the crate::DateTime created will only contain year, and all other fields will be considered not set.

If day is -1, then the crate::DateTime created will only contain year and month and all other fields will be considered not set.

If hour is -1, then the crate::DateTime created will only contain year and month and day, and the time fields will be considered not set. In this case minute and seconds should also be -1.

Free-function: gst_date_time_unref

year

the gregorian year

month

the gregorian month, or -1

day

the day of the gregorian month, or -1

hour

the hour of the day, or -1

minute

the minute of the hour, or -1

seconds

the second of the minute, or -1

Returns

the newly created crate::DateTime

pub fn new_y(year: i32) -> Result<DateTime, BoolError>[src]

Creates a new crate::DateTime using the date and times in the gregorian calendar in the local timezone.

year should be from 1 to 9999.

Free-function: gst_date_time_unref

year

the gregorian year

Returns

the newly created crate::DateTime

pub fn new_ym(year: i32, month: i32) -> Result<DateTime, BoolError>[src]

Creates a new crate::DateTime using the date and times in the gregorian calendar in the local timezone.

year should be from 1 to 9999, month should be from 1 to 12.

If value is -1 then all over value will be ignored. For example if month == -1, then crate::DateTime will created only for year.

Free-function: gst_date_time_unref

year

the gregorian year

month

the gregorian month

Returns

the newly created crate::DateTime

pub fn new_ymd(year: i32, month: i32, day: i32) -> Result<DateTime, BoolError>[src]

Creates a new crate::DateTime using the date and times in the gregorian calendar in the local timezone.

year should be from 1 to 9999, month should be from 1 to 12, day from 1 to 31.

If value is -1 then all over value will be ignored. For example if month == -1, then crate::DateTime will created only for year. If day == -1, then crate::DateTime will created for year and month and so on.

Free-function: gst_date_time_unref

year

the gregorian year

month

the gregorian month

day

the day of the gregorian month

Returns

the newly created crate::DateTime

pub fn day(&self) -> Option<i32>[src]

pub fn hour(&self) -> Option<i32>[src]

pub fn microsecond(&self) -> Option<i32>[src]

pub fn minute(&self) -> Option<i32>[src]

pub fn month(&self) -> Option<i32>[src]

pub fn second(&self) -> Option<i32>[src]

pub fn time_zone_offset(&self) -> Option<f32>[src]

pub fn to_utc(&self) -> Result<DateTime, BoolError>[src]

Trait Implementations

impl Clone for DateTime[src]

fn clone(&self) -> DateTime[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for DateTime[src]

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

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for DateTime[src]

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>[src]

Deserialize this value from the given Serde deserializer. Read more

impl Display for DateTime[src]

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

Formats the value using the given formatter. Read more

impl<'a> From<&'a DateTime> for DateTime[src]

fn from(v: &'a DateTime) -> DateTime[src]

Performs the conversion.

impl From<DateTime> for DateTime[src]

fn from(v: DateTime) -> DateTime[src]

Performs the conversion.

impl PartialEq<DateTime> for DateTime[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<DateTime> for DateTime[src]

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

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'a> Serialize for DateTime[src]

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

Serialize this value into the given Serde serializer. Read more

impl StaticType for DateTime[src]

fn static_type() -> Type[src]

Returns the type identifier of Self.

impl Send for DateTime[src]

impl Sync for DateTime[src]

Auto Trait Implementations

impl RefUnwindSafe for DateTime

impl Unpin for DateTime

impl UnwindSafe for DateTime

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T> ToSendValue for T where
    T: Send + ToValue + ?Sized
[src]

pub fn to_send_value(&self) -> SendValue[src]

Returns a SendValue clone of self.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

impl<'a, T, C> FromValueOptional<'a> for T where
    C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
    T: FromValue<'a, Checker = C>, 
[src]