mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
gstreamer: new_from_g_date_time only returns NULL if arg is NULL
This commit is contained in:
parent
1d726d6a1e
commit
bc5b44ddad
2 changed files with 10 additions and 10 deletions
|
@ -1747,8 +1747,12 @@ status = "generate"
|
|||
|
||||
[[object.function]]
|
||||
name = "new_from_g_date_time"
|
||||
# Function only ever returns NULL if the argument is NULL
|
||||
[[object.function.parameter]]
|
||||
name = "dt"
|
||||
nullable = false
|
||||
[object.function.return]
|
||||
nullable_return_is_error = "Can't create DateTime from glib::DateTime"
|
||||
nullable = false
|
||||
|
||||
[[object.function]]
|
||||
name = "to_g_date_time"
|
||||
|
|
|
@ -308,7 +308,7 @@ impl DateTime {
|
|||
d.to_utc()
|
||||
.ok_or_else(|| glib::glib_bool_error!("Can't convert datetime to UTC"))
|
||||
})
|
||||
.and_then(|d| DateTime::from_g_date_time(&d))
|
||||
.map(|d| d.into())
|
||||
} else {
|
||||
// It would be cheaper to build a `glib::DateTime` direcly, unfortunetaly
|
||||
// this would require using `glib::TimeZone::new_offset` which is feature-gated
|
||||
|
@ -508,19 +508,15 @@ impl fmt::Display for DateTime {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> convert::TryFrom<&'a glib::DateTime> for DateTime {
|
||||
type Error = glib::BoolError;
|
||||
|
||||
fn try_from(v: &'a glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
||||
impl<'a> From<&'a glib::DateTime> for DateTime {
|
||||
fn from(v: &'a glib::DateTime) -> DateTime {
|
||||
skip_assert_initialized!();
|
||||
DateTime::from_g_date_time(v)
|
||||
}
|
||||
}
|
||||
|
||||
impl convert::TryFrom<glib::DateTime> for DateTime {
|
||||
type Error = glib::BoolError;
|
||||
|
||||
fn try_from(v: glib::DateTime) -> Result<DateTime, glib::BoolError> {
|
||||
impl From<glib::DateTime> for DateTime {
|
||||
fn from(v: glib::DateTime) -> DateTime {
|
||||
skip_assert_initialized!();
|
||||
DateTime::from_g_date_time(&v)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue