filthy-rich 0.13.2

Tiny, ergonomic Discord Rich Presence library for your Rust apps.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::errors::InnerParsingError;

pub fn get_current_timestamp() -> Result<u64, InnerParsingError> {
    let s = std::time::SystemTime::now()
        .duration_since(std::time::UNIX_EPOCH)
        .map_err(InnerParsingError::from)?
        .as_secs();

    Ok(s)
}

pub fn filter_none_string(text: impl Into<String>) -> Option<String> {
    let text: String = text.into();

    if !text.is_empty() { Some(text) } else { None }
}