tzf_rs

Struct DefaultFinder

Source
pub struct DefaultFinder { /* private fields */ }
Expand description

It’s most recommend to use, combine both Finder and FuzzyFinder, if FuzzyFinder got no data, then use Finder.

Implementations§

Source§

impl DefaultFinder

Source

pub fn get_tz_name(&self, lng: f64, lat: f64) -> &str

use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();
assert_eq!("Asia/Shanghai", finder.get_tz_name(116.3883, 39.9289));
Source

pub fn get_tz_names(&self, lng: f64, lat: f64) -> Vec<&str>

use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();
println!("{:?}", finder.get_tz_names(116.3883, 39.9289));
Source

pub fn timezonenames(&self) -> Vec<&str>

Returns all time zone names as a Vec<&str>.

use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();
println!("{:?}", finder.timezonenames());
Source

pub fn data_version(&self) -> &str

Returns the version of the data used by this DefaultFinder as a &str.

Example:

use tzf_rs::DefaultFinder;

let finder = DefaultFinder::new();
println!("{:?}", finder.data_version());
Source

pub fn new() -> Self

Creates a new instance of DefaultFinder.

use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();

Trait Implementations§

Source§

impl Default for DefaultFinder

Source§

fn default() -> Self

Creates a new, empty DefaultFinder.

§Example
use tzf_rs::DefaultFinder;
let finder = DefaultFinder::new();

Auto Trait Implementations§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.