pub struct TypeInfo {
pub name: String,
pub import: HashSet<ModuleRef>,
}
Expand description
Type information for creating Python stub files annotated by PyStubType trait.
Fields§
§name: String
The Python type name.
import: HashSet<ModuleRef>
Python modules must be imported in the stub file.
For example, when name
is typing.Sequence[int]
, import
should contain typing
.
This makes it possible to use user-defined types in the stub file.
Implementations§
source§impl TypeInfo
impl TypeInfo
sourcepub fn builtin(name: &str) -> Self
pub fn builtin(name: &str) -> Self
A type annotation of a built-in type, such as int
, str
, or float
. Generic builtin types are also possible, such as dict[str, str]
.
sourcepub fn with_module(name: &str, module: ModuleRef) -> Self
pub fn with_module(name: &str, module: ModuleRef) -> Self
A type annotation of a type that must be imported. The type name must be qualified with the module name:
pyo3_stub_gen::TypeInfo::with_module("pathlib.Path", "pathlib".into());
Trait Implementations§
impl Eq for TypeInfo
impl StructuralPartialEq for TypeInfo
Auto Trait Implementations§
impl Freeze for TypeInfo
impl RefUnwindSafe for TypeInfo
impl Send for TypeInfo
impl Sync for TypeInfo
impl Unpin for TypeInfo
impl UnwindSafe for TypeInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more