pub enum PySourceType {
Python,
Stub,
Ipynb,
}Variants§
Python
The source is a Python file (.py, .pyw).
Note: .pyw files contain Python code, but do not represent importable namespaces.
Consider adding a separate source type later if combining the two causes issues.
Stub
The source is a Python stub file (.pyi).
Ipynb
The source is a Jupyter notebook (.ipynb).
Implementations§
Source§impl PySourceType
impl PySourceType
Sourcepub fn from_extension(extension: &str) -> PySourceType
pub fn from_extension(extension: &str) -> PySourceType
Infers the source type from the file extension.
Falls back to Python if the extension is not recognized.
Sourcepub fn try_from_extension(extension: &str) -> Option<PySourceType>
pub fn try_from_extension(extension: &str) -> Option<PySourceType>
Infers the source type from the file extension.
pub fn try_from_path(path: impl AsRef<Path>) -> Option<PySourceType>
pub const fn is_py_file(self) -> bool
pub const fn is_stub(self) -> bool
pub const fn is_py_file_or_stub(self) -> bool
pub const fn is_ipynb(self) -> bool
Trait Implementations§
Source§impl Clone for PySourceType
impl Clone for PySourceType
Source§fn clone(&self) -> PySourceType
fn clone(&self) -> PySourceType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PySourceType
impl Debug for PySourceType
Source§impl Default for PySourceType
impl Default for PySourceType
Source§fn default() -> PySourceType
fn default() -> PySourceType
Returns the “default value” for a type. Read more
Source§impl<P> From<P> for PySourceType
impl<P> From<P> for PySourceType
Source§fn from(path: P) -> PySourceType
fn from(path: P) -> PySourceType
Converts to this type from the input type.
Source§impl From<PySourceType> for ParseOptions
impl From<PySourceType> for ParseOptions
Source§fn from(source_type: PySourceType) -> ParseOptions
fn from(source_type: PySourceType) -> ParseOptions
Converts to this type from the input type.
Source§impl Hash for PySourceType
impl Hash for PySourceType
Source§impl PartialEq for PySourceType
impl PartialEq for PySourceType
impl Copy for PySourceType
impl Eq for PySourceType
impl StructuralPartialEq for PySourceType
Auto Trait Implementations§
impl Freeze for PySourceType
impl RefUnwindSafe for PySourceType
impl Send for PySourceType
impl Sync for PySourceType
impl Unpin for PySourceType
impl UnsafeUnpin for PySourceType
impl UnwindSafe for PySourceType
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§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