Remove 'Component' from ComponentAccess Traits

This commit is contained in:
Paul Ganssle 2018-08-20 15:15:11 -04:00
parent 003351ba61
commit 3357fabb35
No known key found for this signature in database
GPG key ID: CD54FCE3D964BEFB
3 changed files with 12 additions and 12 deletions

View file

@ -27,19 +27,19 @@ use instance::Py;
use python::{Python, ToPyPointer};
// Traits
pub trait PyDateComponentAccess {
pub trait PyDateAccess {
fn get_year(&self) -> u32;
fn get_month(&self) -> u32;
fn get_day(&self) -> u32;
}
pub trait PyDeltaComponentAccess {
pub trait PyDeltaAccess {
fn get_days(&self) -> i32;
fn get_seconds(&self) -> i32;
fn get_microseconds(&self) -> i32;
}
pub trait PyTimeComponentAccess {
pub trait PyTimeAccess {
fn get_hour(&self) -> u32;
fn get_minute(&self) -> u32;
fn get_second(&self) -> u32;
@ -73,7 +73,7 @@ impl PyDate {
}
}
impl PyDateComponentAccess for PyDate {
impl PyDateAccess for PyDate {
fn get_year(&self) -> u32 {
unsafe { PyDateTime_GET_YEAR(self.as_ptr()) as u32 }
}
@ -138,7 +138,7 @@ impl PyDateTime {
}
}
impl PyDateComponentAccess for PyDateTime {
impl PyDateAccess for PyDateTime {
fn get_year(&self) -> u32 {
unsafe { PyDateTime_GET_YEAR(self.as_ptr()) as u32 }
}
@ -152,7 +152,7 @@ impl PyDateComponentAccess for PyDateTime {
}
}
impl PyTimeComponentAccess for PyDateTime {
impl PyTimeAccess for PyDateTime {
fn get_hour(&self) -> u32 {
unsafe { PyDateTime_DATE_GET_HOUR(self.as_ptr()) as u32 }
}
@ -232,7 +232,7 @@ impl PyTime {
}
}
impl PyTimeComponentAccess for PyTime {
impl PyTimeAccess for PyTime {
fn get_hour(&self) -> u32 {
unsafe { PyDateTime_TIME_GET_HOUR(self.as_ptr()) as u32 }
}
@ -284,7 +284,7 @@ impl PyDelta {
}
}
impl PyDeltaComponentAccess for PyDelta {
impl PyDeltaAccess for PyDelta {
fn get_days(&self) -> i32 {
unsafe { PyDateTime_DELTA_GET_DAYS(self.as_ptr()) as i32 }
}

View file

@ -5,9 +5,9 @@ mod exc_impl;
pub use self::boolobject::PyBool;
pub use self::bytearray::PyByteArray;
pub use self::datetime::PyDeltaComponentAccess;
pub use self::datetime::PyDeltaAccess;
pub use self::datetime::{PyDate, PyDateTime, PyDelta, PyTime, PyTzInfo};
pub use self::datetime::{PyDateComponentAccess, PyTimeComponentAccess};
pub use self::datetime::{PyDateAccess, PyTimeAccess};
pub use self::dict::PyDict;
pub use self::floatob::PyFloat;
pub use self::iterator::PyIterator;

View file

@ -3,12 +3,12 @@
#[macro_use]
extern crate pyo3;
use pyo3::prelude::PyDeltaComponentAccess;
use pyo3::prelude::PyDeltaAccess;
use pyo3::prelude::PyModule;
use pyo3::prelude::PyObject;
use pyo3::prelude::{pyfunction, pymodinit};
use pyo3::prelude::{PyDate, PyDateTime, PyDelta, PyTime, PyTzInfo};
use pyo3::prelude::{PyDateComponentAccess, PyTimeComponentAccess};
use pyo3::prelude::{PyDateAccess, PyTimeAccess};
use pyo3::prelude::{PyDict, PyTuple};
use pyo3::{ObjectProtocol, ToPyObject};
use pyo3::{Py, PyResult, Python};