Skip to main content

TSInterfaceDeclaration

Struct TSInterfaceDeclaration 

Source
#[non_exhaustive]
#[repr(C)]
pub struct TSInterfaceDeclaration<'a> { pub span: Span, pub node_id: Cell<NodeId>, pub scope_id: Cell<Option<ScopeId>>, pub id: BindingIdentifier<'a>, pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>, pub extends: Vec<'a, TSInterfaceHeritage<'a>>, pub body: Box<'a, TSInterfaceBody<'a>>, pub declare: bool, }
Expand description

TypeScriptInterface Declaration

interface BindingIdentifier TypeParameters_opt InterfaceExtendsClause_opt ObjectType

§Example

//                       ___ extends
interface Foo<T> extends Bar {
//     id ^^^ ^ type_parameters
}

§References

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§span: Span§node_id: Cell<NodeId>§scope_id: Cell<Option<ScopeId>>§id: BindingIdentifier<'a>

The identifier (name) of the interface.

§type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>

Type parameters that get bound to the interface.

§extends: Vec<'a, TSInterfaceHeritage<'a>>

Other interfaces/types this interface extends.

§body: Box<'a, TSInterfaceBody<'a>>§declare: bool

true for declare interface Foo {}

Implementations§

Source§

impl<'a> TSInterfaceDeclaration<'a>

Source

pub fn new( span: Span, id: BindingIdentifier<'a>, type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>, extends: impl IntoIn<'a, Vec<'a, TSInterfaceHeritage<'a>>>, body: Box<'a, TSInterfaceBody<'a>>, declare: bool, builder: &impl GetAstBuilder<'a>, ) -> TSInterfaceDeclaration<'a>

Build a TSInterfaceDeclaration.

If you want the built node to be allocated in the memory arena, use TSInterfaceDeclaration::boxed instead.

§Parameters
  • span: The Span covering this node
  • id: The identifier (name) of the interface.
  • type_parameters: Type parameters that get bound to the interface.
  • extends: Other interfaces/types this interface extends.
  • body
  • declare: true for declare interface Foo {}
Source

pub fn boxed( span: Span, id: BindingIdentifier<'a>, type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>, extends: impl IntoIn<'a, Vec<'a, TSInterfaceHeritage<'a>>>, body: Box<'a, TSInterfaceBody<'a>>, declare: bool, builder: &impl GetAstBuilder<'a>, ) -> Box<'a, TSInterfaceDeclaration<'a>>

Build a TSInterfaceDeclaration, and store it in the memory arena.

Returns a Box containing the newly-allocated node. If you want a stack-allocated node, use TSInterfaceDeclaration::new instead.

§Parameters
  • span: The Span covering this node
  • id: The identifier (name) of the interface.
  • type_parameters: Type parameters that get bound to the interface.
  • extends: Other interfaces/types this interface extends.
  • body
  • declare: true for declare interface Foo {}
Source

pub fn new_with_scope_id( span: Span, id: BindingIdentifier<'a>, type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>, extends: impl IntoIn<'a, Vec<'a, TSInterfaceHeritage<'a>>>, body: Box<'a, TSInterfaceBody<'a>>, declare: bool, scope_id: ScopeId, builder: &impl GetAstBuilder<'a>, ) -> TSInterfaceDeclaration<'a>

Build a TSInterfaceDeclaration with scope_id.

If you want the built node to be allocated in the memory arena, use TSInterfaceDeclaration::boxed_with_scope_id instead.

§Parameters
  • span: The Span covering this node
  • id: The identifier (name) of the interface.
  • type_parameters: Type parameters that get bound to the interface.
  • extends: Other interfaces/types this interface extends.
  • body
  • declare: true for declare interface Foo {}
  • scope_id
Source

pub fn boxed_with_scope_id( span: Span, id: BindingIdentifier<'a>, type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>, extends: impl IntoIn<'a, Vec<'a, TSInterfaceHeritage<'a>>>, body: Box<'a, TSInterfaceBody<'a>>, declare: bool, scope_id: ScopeId, builder: &impl GetAstBuilder<'a>, ) -> Box<'a, TSInterfaceDeclaration<'a>>

Build a TSInterfaceDeclaration with scope_id, and store it in the memory arena.

Returns a Box containing the newly-allocated node. If you want a stack-allocated node, use TSInterfaceDeclaration::new_with_scope_id instead.

§Parameters
  • span: The Span covering this node
  • id: The identifier (name) of the interface.
  • type_parameters: Type parameters that get bound to the interface.
  • extends: Other interfaces/types this interface extends.
  • body
  • declare: true for declare interface Foo {}
  • scope_id
Source§

impl TSInterfaceDeclaration<'_>

Source

pub fn node_id(&self) -> NodeId

Get NodeId of TSInterfaceDeclaration.

Only use this method on a post-semantic AST where NodeIds are always defined.

Source

pub fn set_node_id(&self, node_id: NodeId)

Source

pub fn scope_id(&self) -> ScopeId

Get ScopeId of TSInterfaceDeclaration.

Only use this method on a post-semantic AST where ScopeIds are always defined.

§Panics

Panics if scope_id is None.

Source

pub fn set_scope_id(&self, scope_id: ScopeId)

Trait Implementations§

Source§

impl<'new_alloc> CloneIn<'new_alloc> for TSInterfaceDeclaration<'_>

Source§

type Cloned = TSInterfaceDeclaration<'new_alloc>

The type of the cloned object. Read more
Source§

fn clone_in_impl( &self, with_semantic_ids: CloneInSemanticIds, allocator: &'new_alloc Allocator, ) -> <TSInterfaceDeclaration<'_> as CloneIn<'new_alloc>>::Cloned

Clone self into allocator, threading whether semantic ids should be preserved as a runtime with_semantic_ids flag rather than as two separate methods. Read more
Source§

fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned

Clone self into the given allocator. allocator may be the same one that self is already in.
Source§

fn clone_in_with_semantic_ids( &self, allocator: &'new_alloc Allocator, ) -> Self::Cloned

Almost identical as clone_in, but for some special type, it will also clone the semantic ids. Please use this method only if you make sure semantic info is synced with the ast node.
Source§

impl ContentEq for TSInterfaceDeclaration<'_>

Source§

fn content_eq(&self, other: &TSInterfaceDeclaration<'_>) -> bool

This method tests for contents of self and other to be equal.
Source§

fn content_ne(&self, other: &Self) -> bool

This method tests for contents of self and other not to be equal. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Debug for TSInterfaceDeclaration<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Dummy<'a> for TSInterfaceDeclaration<'a>

Source§

fn dummy(allocator: &'a Allocator) -> TSInterfaceDeclaration<'a>

Create a dummy TSInterfaceDeclaration.

Has cost of making 1 allocation (40 bytes).

Source§

impl Gen for TSInterfaceDeclaration<'_>

Source§

fn gen(&self, p: &mut Codegen<'_>, ctx: Context)

Generate code for an AST node.
Source§

fn print(&self, p: &mut Codegen<'_>, ctx: Context)

Generate code for an AST node. Alias for gen.
Source§

impl GetNodeId for TSInterfaceDeclaration<'_>

Source§

fn node_id(&self) -> NodeId

Get the NodeId for an AST node.
Source§

impl GetSpan for TSInterfaceDeclaration<'_>

Source§

fn span(&self) -> Span

Get the Span for an AST node.
Source§

impl GetSpanMut for TSInterfaceDeclaration<'_>

Source§

fn span_mut(&mut self) -> &mut Span

Get a mutable reference to an AST node’s Span.
Source§

impl<'a> ReplaceWith<'a> for TSInterfaceDeclaration<'a>

Source§

fn replace_with(&mut self, replacer: impl FnOnce(Self) -> Self)

Replace the node in place with the value returned by replacer. Read more
Source§

impl<'a> TakeIn<'a> for TSInterfaceDeclaration<'a>

Source§

fn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self

Replace node with a dummy, and return the original. Read more
Source§

fn take_in_box( &mut self, allocator_accessor: &impl GetAllocator<'a>, ) -> Box<'a, Self>

Replace node with a dummy, allocate the original node into the arena, and return it as a Box<Self>. Read more
Source§

impl UnstableAddress for TSInterfaceDeclaration<'_>

Source§

fn unstable_address(&self) -> Address

Get the memory Address of a reference to an AST node in arena, which is not necessarily stable. 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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.