pub struct Struct {Show 13 fields
pub rust_name: Ident,
pub js_name: String,
pub qualified_name: String,
pub fields: Vec<StructField>,
pub comments: Vec<String>,
pub is_inspectable: bool,
pub generate_typescript: bool,
pub private: bool,
pub js_namespace: Option<Vec<String>>,
pub extends: Option<Path>,
pub extends_js_class: Option<String>,
pub extends_js_namespace: Option<Vec<String>>,
pub wasm_bindgen: Path,
}Expand description
Information about a Struct being exported
Fields§
§rust_name: IdentThe name of the struct in Rust code
js_name: StringThe export name of the struct in JS code
qualified_name: StringThe namespace-qualified internal name used for wasm symbol generation.
When a namespace is present, this is ns1_ns2_JsName; otherwise it equals js_name.
fields: Vec<StructField>All the fields of this struct to export
comments: Vec<String>The doc comments on this struct, if provided
is_inspectable: boolWhether this struct is inspectable (provides toJSON/toString properties to JS)
generate_typescript: boolWhether to generate a typescript definition for this struct
private: boolWhether to skip exporting this struct from the module exports
js_namespace: Option<Vec<String>>The namespace to export the struct through, if any
extends: Option<Path>The parent type this struct extends, if any. When set, the macro
auto-injects a parent: wasm_bindgen::Parent<Parent> field at the
head of the struct; that field is used as the upcast projection
target. Users must not declare a Parent<T> field themselves.
extends_js_class: Option<String>The JS-side js_name of the parent class, declared on the child
via extends_js_class = "...". Required when the parent struct
uses js_name: the child macro cannot see the parent struct’s
attributes cross-invocation, so the parent’s JS-side identity must
be redeclared here for exported_classes lookup to resolve.
Defaults to the last segment of the extends Rust path (matching
the no-rename case).
extends_js_namespace: Option<Vec<String>>The JS-side js_namespace of the parent class, declared on the
child via extends_js_namespace = .... Required when the parent
struct uses js_namespace. Defaults to None.
wasm_bindgen: PathPath to wasm_bindgen
Trait Implementations§
Source§impl ToTokens for Struct
impl ToTokens for Struct
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for Struct
impl !Sync for Struct
impl Freeze for Struct
impl RefUnwindSafe for Struct
impl Unpin for Struct
impl UnsafeUnpin for Struct
impl UnwindSafe for Struct
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.