Struct cftime_rs::py_bindings::PyCFDatetime
source · pub struct PyCFDatetime {
pub dt: Arc<CFDatetime>,
}Expand description
PyCFDatetime is a wrapper around Rust CFDatetime It represents a date in a specific calendar All the methods depends on the Calendar definitions found in udunits package
Fields§
§dt: Arc<CFDatetime>Implementations§
source§impl PyCFDatetime
impl PyCFDatetime
sourcepub fn new(
year: i64,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: f32,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn new( year: i64, month: u8, day: u8, hour: u8, minute: u8, second: f32, calendar: PyCFCalendar ) -> PyResult<Self>
Makes a new PyCFDatetime with given year, month, day, hour, minute, second and specific calendar
sourcepub fn ymd_hms(&self) -> PyResult<(i64, u8, u8, u8, u8, u8)>
pub fn ymd_hms(&self) -> PyResult<(i64, u8, u8, u8, u8, u8)>
Returns the year, month, day, hour, minute, second of the date.
sourcepub fn from_ymd_hms(
year: i64,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: f32,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn from_ymd_hms( year: i64, month: u8, day: u8, hour: u8, minute: u8, second: f32, calendar: PyCFCalendar ) -> PyResult<Self>
Makes a new PyCFDatetime with given year, month, day, hour, minute, second and specific calendar
sourcepub fn from_hms(
hour: u8,
minute: u8,
second: f32,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn from_hms( hour: u8, minute: u8, second: f32, calendar: PyCFCalendar ) -> PyResult<Self>
Makes a new PyCFDatetime with given hour, minute, second and specific calendar.
The year, month, day are set to 1970-01-01
sourcepub fn from_ymd(
year: i64,
month: u8,
day: u8,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn from_ymd( year: i64, month: u8, day: u8, calendar: PyCFCalendar ) -> PyResult<Self>
Makes a new PyCFDatetime with given year, month, day and specific calendar.
The hour, minute, second are set to 0
sourcepub fn from_timestamp(
timestamp: i64,
nanoseconds: u32,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn from_timestamp( timestamp: i64, nanoseconds: u32, calendar: PyCFCalendar ) -> PyResult<Self>
Makes a new PyCFDatetime with given timestamp, nanoseconds and specific calendar.
sourcepub fn nanoseconds(&self) -> u32
pub fn nanoseconds(&self) -> u32
Returns the nanoseconds of the date.
sourcepub fn change_calendar(&self, calendar: PyCFCalendar) -> PyResult<Self>
pub fn change_calendar(&self, calendar: PyCFCalendar) -> PyResult<Self>
sourcepub fn change_calendar_from_timestamp(
&self,
calendar: PyCFCalendar
) -> PyResult<Self>
pub fn change_calendar_from_timestamp( &self, calendar: PyCFCalendar ) -> PyResult<Self>
Trait Implementations§
source§impl Clone for PyCFDatetime
impl Clone for PyCFDatetime
source§fn clone(&self) -> PyCFDatetime
fn clone(&self) -> PyCFDatetime
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Display for PyCFDatetime
impl Display for PyCFDatetime
source§impl PyClassImpl for PyCFDatetime
impl PyClassImpl for PyCFDatetime
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type Layout = PyCell<PyCFDatetime>
type Layout = PyCell<PyCFDatetime>
§type ThreadChecker = ThreadCheckerStub<PyCFDatetime>
type ThreadChecker = ThreadCheckerStub<PyCFDatetime>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
impl PyClassNewTextSignature<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyClass__add__SlotFragment<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
impl PyClass__add__SlotFragment<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
source§impl PyClass__sub__SlotFragment<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
impl PyClass__sub__SlotFragment<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyCFDatetime
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyCFDatetime
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyCFDatetime
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyCFDatetime
source§impl PyMethods<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
impl PyMethods<PyCFDatetime> for PyClassImplCollector<PyCFDatetime>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for PyCFDatetime
impl PyTypeInfo for PyCFDatetime
§type AsRefTarget = PyCell<PyCFDatetime>
type AsRefTarget = PyCell<PyCFDatetime>
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object is an instance of this type.