Skip to main content

PyGeoDb

Struct PyGeoDb 

Source
pub struct PyGeoDb { /* private fields */ }

Implementations§

Source§

impl PyGeoDb

Source

pub fn load(path: &str) -> PyResult<Self>

Source

pub fn load_default() -> PyResult<Self>

Source

pub fn load_filtered(iso2_list: Vec<String>) -> PyResult<Self>

Source

pub fn stats(&self) -> PyResult<(usize, usize, usize)>

Source

pub fn countries<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>

Return a list of all countries as dicts

Source

pub fn find_country<'py>( &self, py: Python<'py>, code: &str, ) -> PyResult<Option<Bound<'py, PyAny>>>

Find a country by ISO2/ISO3/code and return as dict (or None)

Source

pub fn states_in_country<'py>( &self, py: Python<'py>, iso2: &str, ) -> PyResult<Option<Bound<'py, PyAny>>>

List all states for a given country ISO2 as dicts

Source

pub fn search_countries_by_phone<'py>( &self, py: Python<'py>, phone: &str, ) -> PyResult<Bound<'py, PyAny>>

Find countries by phone code (e.g. “+49”, “1”) and return list of dicts

Source

pub fn find_states_by_substring<'py>( &self, py: Python<'py>, substr: &str, ) -> PyResult<Bound<'py, PyAny>>

Find states containing a substring (ASCII, case-insensitive). Returns list of dicts

Source

pub fn find_cities_by_substring<'py>( &self, py: Python<'py>, substr: &str, ) -> PyResult<Bound<'py, PyAny>>

Find cities containing a substring (ASCII, case-insensitive). Returns list of dicts

Smart search across countries, states, cities, and phone codes. Returns list of dicts

Trait Implementations§

Source§

impl DerefToPyAny for PyGeoDb

Source§

impl IntoPy<Py<PyAny>> for PyGeoDb

Source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
Source§

impl PyClass for PyGeoDb

Source§

type Frozen = False

Whether the pyclass is frozen. Read more
Source§

impl PyClassImpl for PyGeoDb

Source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
Source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
Source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
Source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
Source§

type BaseType = PyAny

Base class
Source§

type ThreadChecker = SendablePyClass<PyGeoDb>

This handles following two situations: Read more
Source§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
Source§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
Source§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
Source§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
Source§

fn items_iter() -> PyClassItemsIter

Source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
Source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

Source§

fn dict_offset() -> Option<isize>

Source§

fn weaklist_offset() -> Option<isize>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyGeoDb

Source§

type Holder = Option<PyRef<'py, PyGeoDb>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PyGeoDb

Source§

type Holder = Option<PyRefMut<'py, PyGeoDb>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl PyMethods<PyGeoDb> for PyClassImplCollector<PyGeoDb>

Source§

fn py_methods(self) -> &'static PyClassItems

Source§

impl PyTypeInfo for PyGeoDb

Source§

const NAME: &'static str = "PyGeoDb"

Class name.
Source§

const MODULE: Option<&'static str> = ::core::option::Option::None

Module name, if any.
Source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
Source§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
Source§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
Source§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.

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> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

Source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
Source§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

Source§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
Source§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. 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.
Source§

impl<T> Ungil for T
where T: Send,