Skip to main content

Date

Struct Date 

Source
pub struct Date {
    pub year: u8,
    pub month: u8,
    pub day: u8,
    pub day_of_week: u8,
}
Expand description

BACnet Date: year, month, day, day-of-week.

  • Year: 0-254 relative to 1900 (0xFF = unspecified)
  • Month: 1-14 (13=odd, 14=even, 0xFF=unspecified)
  • Day: 1-34 (32=last, 33=odd, 34=even, 0xFF=unspecified)
  • Day of week: 1=Monday..7=Sunday (0xFF=unspecified)

Fields§

§year: u8

Year minus 1900 (0-254, or 0xFF for unspecified).

§month: u8

Month (1-14, or 0xFF for unspecified).

§day: u8

Day of month (1-34, or 0xFF for unspecified).

§day_of_week: u8

Day of week (1=Monday..7=Sunday, or 0xFF for unspecified).

Implementations§

Source§

impl Date

Source

pub fn is_unspecified(&self) -> bool

Whether every octet is unspecified, the date that matches any date.

Source

pub fn is_valid_pattern(&self) -> bool

Whether every octet holds a value Clause 20.2.12 defines for a date pattern: any year; month 1 to 14; day 1 to 34; weekday 1 to 7; each of them, or all, unspecified.

Source

pub fn matches(&self, day: SpecificDate) -> bool

Whether this date, read as a pattern, matches day: each specified octet must agree, including the odd, even and last-day values.

Source§

impl Date

Source

pub const UNSPECIFIED: u8 = 0xFF

Value indicating “unspecified” for any date field.

Source

pub fn encode(&self) -> [u8; 4]

Encode to 4 bytes.

Source

pub fn decode(data: &[u8]) -> Result<Self, Error>

Decode from 4 bytes.

Source

pub fn actual_year(&self) -> Option<u16>

Get the actual year (1900 + year field), or None if unspecified.

Trait Implementations§

Source§

impl Clone for Date

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Date

Source§

impl Debug for Date

Source§

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

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

impl Eq for Date

Source§

impl Hash for Date

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 PartialEq for Date

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Date

Auto Trait Implementations§

§

impl Freeze for Date

§

impl RefUnwindSafe for Date

§

impl Send for Date

§

impl Sync for Date

§

impl Unpin for Date

§

impl UnsafeUnpin for Date

§

impl UnwindSafe for Date

Blanket Implementations§

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> 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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.