[−][src]Struct brawl_api::time::TimeLike
Represents a timestamp provided by the Brawl API. If the chrono
feature is enabled (it is
by default), then it is possible to use helper methods to convert it to chrono
data
structures - see TimeLike.parse
(this is recommended, as it is aware of the correct
format).
Methods
impl TimeLike
[src]
pub fn parse(&self) -> Result<DateTime<Utc>>
[src]
Parses this timestamp into a chrono::DateTime<chrono::Utc>
, using the API's
format (see constants::TIMELIKE_FORMAT
).
Errors
If the string is invalid, an Error::ParseTimeLike
is returned.
Generally, when requesting from the API, this shouldn't ever happen.
Examples
use brawl_api::prelude::*; use brawl_api::{TimeLike, Battle}; use chrono::{DateTime, Utc}; // after obtaining a fetched battlelog's battle let battle: Battle; let mut the_time: TimeLike = battle.battle_time; let parsed_time: DateTime<Utc> = the_time.parse()?; // the parsed time of the battle is now available for use.
impl TimeLike
[src]
pub fn inner(&self) -> &String
[src]
Returns an immutable reference to the inner string.
pub fn inner_mut(&mut self) -> &mut String
[src]
Returns a mutable reference to the inner string.
Trait Implementations
impl Clone for TimeLike
[src]
impl Debug for TimeLike
[src]
impl Default for TimeLike
[src]
fn default() -> TimeLike
[src]
Returns an initial TimeLike
instance containing an empty string.
Examples
use brawl_api::TimeLike; assert_eq!( TimeLike::default().to_string(), "", )
impl<'de> Deserialize<'de> for TimeLike
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for TimeLike
[src]
impl Eq for TimeLike
[src]
impl Hash for TimeLike
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<TimeLike> for TimeLike
[src]
impl Serialize for TimeLike
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for TimeLike
[src]
impl StructuralPartialEq for TimeLike
[src]
Auto Trait Implementations
impl RefUnwindSafe for TimeLike
impl Send for TimeLike
impl Sync for TimeLike
impl Unpin for TimeLike
impl UnwindSafe for TimeLike
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> FetchFrom<T> for T where
T: Clone + Send + Sync,
[src]
T: Clone + Send + Sync,
fn fetch_from(&Client, &T) -> Result<T, Error>
[src]
(Sync) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
Errors
Never errors; is only a Result
in order to match the trait signature.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
&'life0 Client,
&'life1 T
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
[src]
&'life0 Client,
&'life1 T
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
(Async) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
Errors
Never errors; is only a Result
in order to match the trait signature.
impl<T, U> FetchInto<U> for T where
T: Sync + Send,
U: FetchFrom<T> + Sync + Send,
[src]
T: Sync + Send,
U: FetchFrom<T> + Sync + Send,
fn fetch_into(&Self, &Client) -> Result<U, Error>
[src]
fn a_fetch_into<'life0, 'life1, 'async_trait>(
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<U, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
U: 'async_trait,
[src]
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<U, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
U: 'async_trait,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,