pub trait StdLibFn: Debug + Send + Sync {
Show 15 methods
// Required methods
fn name(&self) -> String;
fn summary(&self) -> String;
fn description(&self) -> String;
fn tags(&self) -> Vec<String>;
fn args(&self) -> Vec<StdLibFnArg>;
fn return_value(&self) -> Option<StdLibFnArg>;
fn unpublished(&self) -> bool;
fn deprecated(&self) -> bool;
fn examples(&self) -> Vec<String>;
fn std_lib_fn(&self) -> StdFn;
fn clone_box(&self) -> Box<dyn StdLibFn>;
// Provided methods
fn to_json(&self) -> Result<StdLibFnData> { ... }
fn fn_signature(&self) -> String { ... }
fn to_completion_item(&self) -> CompletionItem { ... }
fn to_signature_help(&self) -> SignatureHelp { ... }
}
Expand description
This trait defines functions called upon stdlib functions to generate documentation for them.
Required Methods§
sourcefn description(&self) -> String
fn description(&self) -> String
The description of the function.
The tags of the function.
sourcefn args(&self) -> Vec<StdLibFnArg>
fn args(&self) -> Vec<StdLibFnArg>
The args of the function.
sourcefn return_value(&self) -> Option<StdLibFnArg>
fn return_value(&self) -> Option<StdLibFnArg>
The return value of the function.
sourcefn unpublished(&self) -> bool
fn unpublished(&self) -> bool
If the function is unpublished.
sourcefn deprecated(&self) -> bool
fn deprecated(&self) -> bool
If the function is deprecated.
sourcefn std_lib_fn(&self) -> StdFn
fn std_lib_fn(&self) -> StdFn
The function itself.
Provided Methods§
sourcefn to_json(&self) -> Result<StdLibFnData>
fn to_json(&self) -> Result<StdLibFnData>
Return a JSON struct representing the function.
fn fn_signature(&self) -> String
fn to_completion_item(&self) -> CompletionItem
fn to_signature_help(&self) -> SignatureHelp
Trait Implementations§
source§impl<'de> Deserialize<'de> for Box<dyn StdLibFn>
impl<'de> Deserialize<'de> for Box<dyn StdLibFn>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl JsonSchema for dyn StdLibFn
impl JsonSchema for dyn StdLibFn
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresource§impl TS for dyn StdLibFn
impl TS for dyn StdLibFn
const EXPORT_TO: Option<&'static str> = _
source§fn dependencies() -> Vec<Dependency>where
Self: 'static,
fn dependencies() -> Vec<Dependency>where
Self: 'static,
Information about types this type depends on.
This is used for resolving imports when exporting to a file.
source§fn transparent() -> bool
fn transparent() -> bool
true
if this is a transparent type, e.g tuples or a list.This is used for resolving imports when using the
export!
macro.source§fn decl() -> String
fn decl() -> String
Declaration of this type, e.g.
interface User { user_id: number, ... }
.
This function will panic if the type has no declaration.source§fn name_with_type_args(args: Vec<String>) -> String
fn name_with_type_args(args: Vec<String>) -> String
Name of this type in TypeScript, with type arguments.
source§fn inline() -> String
fn inline() -> String
Formats this types definition in TypeScript, e.g
{ user_id: number }
.
This function will panic if the type cannot be inlined.source§fn inline_flattened() -> String
fn inline_flattened() -> String
Flatten an type declaration.
This function will panic if the type cannot be flattened.
This function will panic if the type cannot be flattened.
source§fn export() -> Result<(), ExportError>where
Self: 'static,
fn export() -> Result<(), ExportError>where
Self: 'static,
Manually export this type to a file.
The output file can be specified by annotating the type with
#[ts(export_to = ".."]
.
By default, the filename will be derived from the types name. Read moresource§fn export_to(path: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
fn export_to(path: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
Manually export this type to a file with a file with the specified path. This
function will ignore the
#[ts(export_to = "..)]
attribute.source§fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
Manually generate bindings for this type, returning a
This function does not format the output, even if the
String
.This function does not format the output, even if the
format
feature is enabled.