Struct pyo3_macros_backend::method::FnSpec
source · [−]pub struct FnSpec<'a> {
pub tp: FnType,
pub name: &'a Ident,
pub python_name: Ident,
pub attrs: Vec<Argument>,
pub args: Vec<FnArg<'a>>,
pub output: Type,
pub doc: PythonDoc,
pub deprecations: Deprecations,
pub convention: CallingConvention,
pub text_signature: Option<TextSignatureAttribute>,
pub krate: Path,
pub unsafety: Option<Unsafe>,
}
Fields
tp: FnType
name: &'a Ident
python_name: Ident
attrs: Vec<Argument>
args: Vec<FnArg<'a>>
output: Type
doc: PythonDoc
deprecations: Deprecations
convention: CallingConvention
text_signature: Option<TextSignatureAttribute>
krate: Path
unsafety: Option<Unsafe>
Implementations
sourceimpl<'a> FnSpec<'a>
impl<'a> FnSpec<'a>
sourcepub fn parse(
sig: &'a mut Signature,
meth_attrs: &mut Vec<Attribute>,
options: PyFunctionOptions
) -> Result<FnSpec<'a>>
pub fn parse(
sig: &'a mut Signature,
meth_attrs: &mut Vec<Attribute>,
options: PyFunctionOptions
) -> Result<FnSpec<'a>>
Parser function signature and function attributes
pub fn null_terminated_python_name(&self) -> LitStr
fn ensure_text_signature_on_valid_method(
fn_type: &FnType,
text_signature: Option<&TextSignatureAttribute>
) -> Result<()>
fn parse_fn_type(
sig: &Signature,
fn_type_attr: Option<MethodTypeAttribute>,
python_name: &mut Option<Ident>
) -> Result<(FnType, bool, Option<CallingConvention>)>
pub fn default_value(&self, name: &Ident) -> Option<TokenStream>
pub fn is_pos_only(&self, name: &Ident) -> bool
pub fn is_kw_only(&self, name: &Ident) -> bool
sourcepub fn get_wrapper_function(
&self,
ident: &Ident,
cls: Option<&Type>
) -> Result<TokenStream>
pub fn get_wrapper_function(
&self,
ident: &Ident,
cls: Option<&Type>
) -> Result<TokenStream>
Return a C wrapper function for this signature.
sourcepub fn get_methoddef(&self, wrapper: impl ToTokens) -> TokenStream
pub fn get_methoddef(&self, wrapper: impl ToTokens) -> TokenStream
Return a PyMethodDef
constructor for this function, matching the selected
calling convention.
Auto Trait Implementations
impl<'a> RefUnwindSafe for FnSpec<'a>
impl<'a> !Send for FnSpec<'a>
impl<'a> !Sync for FnSpec<'a>
impl<'a> Unpin for FnSpec<'a>
impl<'a> UnwindSafe for FnSpec<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more