pub struct FnSpec<'a> {
pub tp: FnType,
pub name: &'a Ident,
pub python_name: Ident,
pub signature: FunctionSignature<'a>,
pub convention: CallingConvention,
pub text_signature: Option<KeywordAttribute<text_signature, TextSignatureAttributeValue>>,
pub asyncness: Option<Async>,
pub unsafety: Option<Unsafe>,
}
Fields§
§tp: FnType
§name: &'a Ident
§python_name: Ident
§signature: FunctionSignature<'a>
§convention: CallingConvention
§text_signature: Option<KeywordAttribute<text_signature, TextSignatureAttributeValue>>
§asyncness: Option<Async>
§unsafety: Option<Unsafe>
Implementations§
Source§impl<'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, ctx: &Ctx) -> LitCStr
fn parse_fn_type( sig: &Signature, meth_attrs: &mut Vec<Attribute>, python_name: &mut Option<Ident>, ) -> Result<FnType>
Sourcepub fn get_wrapper_function(
&self,
ident: &Ident,
cls: Option<&Type>,
ctx: &Ctx,
) -> Result<TokenStream>
pub fn get_wrapper_function( &self, ident: &Ident, cls: Option<&Type>, ctx: &Ctx, ) -> Result<TokenStream>
Return a C wrapper function for this signature.
Sourcepub fn get_methoddef(
&self,
wrapper: impl ToTokens,
doc: &PythonDoc,
ctx: &Ctx,
) -> TokenStream
pub fn get_methoddef( &self, wrapper: impl ToTokens, doc: &PythonDoc, ctx: &Ctx, ) -> TokenStream
Return a PyMethodDef
constructor for this function, matching the selected
calling convention.
Sourcepub fn get_doc(&self, attrs: &[Attribute], ctx: &Ctx) -> PythonDoc
pub fn get_doc(&self, attrs: &[Attribute], ctx: &Ctx) -> PythonDoc
Forwards to utils::get_doc with the text signature of this spec.
Sourcepub fn text_signature_call_signature(&self) -> Option<String>
pub fn text_signature_call_signature(&self) -> Option<String>
Creates the parenthesised arguments list for __text_signature__
snippet based on this spec’s signature
and/or attributes. Prepend the callable name to make a complete __text_signature__
.
Auto Trait Implementations§
impl<'a> Freeze for FnSpec<'a>
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§
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