Expand description
Experimental high-level representation (HIR) for Diplomat.
Enabled with the "hir" Cargo feature
Re-exports§
pub use crate::ast::Docs;pub use crate::ast::DocsUrlGenerator;pub use crate::ast::attrs::RenameAttr;pub use ast::Mutability;pub use ast::StringEncoding;
Modules§
- borrowing_
field - Tools for traversing all borrows in method parameters and return types, transitively
- borrowing_
param - Tools for traversing all borrows in method parameters and return types, shallowly
Structs§
- Attrs
- Diplomat attribute that can be specified on items, methods, and enum variants. These can be used to control the codegen in a particular backend.
- Backend
Attr Support - Non-exhaustive list of what attributes and other features your backend is able to handle, based on #[diplomat::attr(…)] contents.
Set this through an
AttributeValidator. - Basic
Attribute Validator - A basic attribute validator
- Borrow
- Callback
- Callback
Param - A parameter in a callback No name, since all we get is the callback type signature
- Demo
Info - Demo
InputCFG - For
#[diplomat::demo(input(...))], stored in DemoInfo::input_cfg. - EnumDef
- The enum type.
- EnumId
- Key used to index into a
TypeContextrepresenting an enum. - Enum
Path - Path to an enum.
- Enum
Variant - A variant of an [
Enum]. - Error
Context - Everywhere
- One of 3 types implementing
TyPosition, representing types that can be used as both input and output to functions. - Input
Only - One of 3 types implementing
TyPosition, representing types that can only be used as input types in functions. - Lifetime
- A lifetime that exists as part of a type name, struct signature, or method signature.
- Lifetime
Env - The lifetimes and bounds found on a method or type definition
- Lifetimes
- A set of lifetimes found on a type name, struct signature, or method signature
- Linked
Lifetimes - Convenience type for linking the lifetimes found at a type use site (e.g.
&'c Foo<'a, 'b>) with the lifetimes found at its def site (e.g.struct Foo<'x, 'y>). - Lowering
Config - Additional features/config to support while lowering
- Method
- A method exposed to Diplomat.
- NonOptional
- Opaque
Def - A struct whose contents are opaque across the FFI boundary, and can only cross when behind a pointer.
- Opaque
Id - Key used to index into a
TypeContextrepresenting a opaque. - Opaque
Path - Path to an opaque.
- Optional
- OutStruct
Id - Key used to index into a
TypeContextrepresenting an out struct. - Output
Only - One of 3 types implementing
TyPosition, representing types that can only be used as return types in functions. - Param
- A parameter in a method.
- Param
Self - The
selfparameter of a method. - Special
Method Presence - For special methods that affect type semantics, whether this type has this method.
- Struct
Def - Structs that can be either inputs or outputs in methods.
- Struct
Field - A field on a [
Struct]s. - Struct
Id - Key used to index into a
TypeContextrepresenting a struct. - Struct
Path - Path to a struct that can be used in inputs and outputs.
- Subtype
Lifetime Visitor - Visit subtype lifetimes recursively, keeping track of which have already been visited.
- Trait
Def - TraitId
- Key used to index into a
TypeContextrepresenting a trait. - Trait
Param Self - Trait
Path - Type
Context - A context type owning all types exposed to Diplomat.
Enums§
- Attribute
Context - Where the attribute was found. Some attributes are only allowed in some contexts (e.g. namespaces cannot be specified on methods)
- Float
Type - 32 and 64-bit floating point numbers.
- Input
OrOutput - Directionality of the type
- Int128
Type - 128-bit signed and unsigned integers.
- IntSize
Type - Platform-dependent signed and unsigned size types.
- IntType
- 8, 16, 32, and 64-bit signed and unsigned integers.
- Lowering
Error - An error from lowering the AST to the HIR.
- Maybe
Own - Determine whether a pointer to an opaque type is owned or borrowed.
- Maybe
Static - Wrapper type for
LifetimeandLifetime, indicating that it may be the'staticlifetime. - NoCallback
- NoTrait
Path - Non-instantiable enum to denote the trait path in TyPositions that don’t allow traits (anything not InputOnly)
- Primitive
Type - All primitive types.
- Return
Type - Whether or not the method returns a value or a result.
- Returnable
Struct Def - Returnable
Struct Path - Path to a struct that may appear as an output.
- Self
Type - Type that can appear in the
selfposition. - Slice
- Special
Method - Attributes that mark methods as “special”
- Success
Type - Type that the method returns.
- Symbol
Id - Type
- Type that may be used as input or output.
- TypeDef
- TypeId
Traits§
- Attribute
Validator - Defined by backends when validating attributes
- Callback
Instantiation Functionality - Opaque
Owner - Abstraction over how a type can hold a pointer to an opaque.
- Struct
Path Like - Trait
IdGetter - TyPosition
- Abstraction over where a type can appear in a function signature.
Type Aliases§
- Error
AndContext - Ident
- Borrowed checked string containing a Rust identifier.
- Ident
Buf - Owned checked string containing a Rust identifier.
- OutStruct
Def - Structs that can only be returned from methods.
- OutStruct
Field - A field on a [
OutStruct]s. - OutStruct
Path - Path to a struct that can only be used as an output.
- OutType
- Type that can only be used as an output.