Skip to main content

Struct

Struct Struct 

Source
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: Ident

The name of the struct in Rust code

§js_name: String

The export name of the struct in JS code

§qualified_name: String

The 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: bool

Whether this struct is inspectable (provides toJSON/toString properties to JS)

§generate_typescript: bool

Whether to generate a typescript definition for this struct

§private: bool

Whether 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: Path

Path to wasm_bindgen

Trait Implementations§

Source§

impl Clone for Struct

Source§

fn clone(&self) -> Struct

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ToTokens for Struct

Source§

fn to_tokens(&self, tokens: &mut TokenStream)

Write self to the given TokenStream. Read more
Source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
Source§

fn into_token_stream(self) -> TokenStream
where Self: Sized,

Convert self directly into a TokenStream object. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Spanned for T
where T: Spanned + ?Sized,

Source§

fn span(&self) -> Span

Returns a Span covering the complete contents of this syntax tree node, or Span::call_site() if this node is empty.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.