pub struct TsFunction {
pub name: String,
pub parameters: Vec<TsParameter>,
pub return_type: TsType,
pub is_async: bool,
pub description: Option<String>,
pub examples: Vec<String>,
}Expand description
Function signature
Fields§
§name: StringFunction name
parameters: Vec<TsParameter>Parameters
return_type: TsTypeReturn type
is_async: boolIs async
description: Option<String>Description
examples: Vec<String>Example code
Implementations§
Source§impl TsFunction
impl TsFunction
Sourcepub fn parameter(self, param: TsParameter) -> Self
pub fn parameter(self, param: TsParameter) -> Self
Adds a parameter
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets a description
Sourcepub fn with_example(self, example: impl Into<String>) -> Self
pub fn with_example(self, example: impl Into<String>) -> Self
Adds an example
Sourcepub fn to_ts_declaration(&self) -> String
pub fn to_ts_declaration(&self) -> String
Generates TypeScript declaration
Trait Implementations§
Source§impl Clone for TsFunction
impl Clone for TsFunction
Source§fn clone(&self) -> TsFunction
fn clone(&self) -> TsFunction
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 TsFunction
impl Debug for TsFunction
Source§impl<'de> Deserialize<'de> for TsFunction
impl<'de> Deserialize<'de> for TsFunction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TsFunction
impl RefUnwindSafe for TsFunction
impl Send for TsFunction
impl Sync for TsFunction
impl Unpin for TsFunction
impl UnsafeUnpin for TsFunction
impl UnwindSafe for TsFunction
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