[go: up one dir, main page]

Module hir

Source
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.
BackendAttrSupport
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.
BasicAttributeValidator
A basic attribute validator
Borrow
Callback
CallbackParam
A parameter in a callback No name, since all we get is the callback type signature
DemoInfo
DemoInputCFG
For #[diplomat::demo(input(...))], stored in DemoInfo::input_cfg.
EnumDef
The enum type.
EnumId
Key used to index into a TypeContext representing an enum.
EnumPath
Path to an enum.
EnumVariant
A variant of an [Enum].
ErrorContext
Everywhere
One of 3 types implementing TyPosition, representing types that can be used as both input and output to functions.
InputOnly
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.
LifetimeEnv
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
LinkedLifetimes
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>).
LoweringConfig
Additional features/config to support while lowering
Method
A method exposed to Diplomat.
NonOptional
OpaqueDef
A struct whose contents are opaque across the FFI boundary, and can only cross when behind a pointer.
OpaqueId
Key used to index into a TypeContext representing a opaque.
OpaquePath
Path to an opaque.
Optional
OutStructId
Key used to index into a TypeContext representing an out struct.
OutputOnly
One of 3 types implementing TyPosition, representing types that can only be used as return types in functions.
Param
A parameter in a method.
ParamSelf
The self parameter of a method.
SpecialMethodPresence
For special methods that affect type semantics, whether this type has this method.
StructDef
Structs that can be either inputs or outputs in methods.
StructField
A field on a [Struct]s.
StructId
Key used to index into a TypeContext representing a struct.
StructPath
Path to a struct that can be used in inputs and outputs.
SubtypeLifetimeVisitor
Visit subtype lifetimes recursively, keeping track of which have already been visited.
TraitDef
TraitId
Key used to index into a TypeContext representing a trait.
TraitParamSelf
TraitPath
TypeContext
A context type owning all types exposed to Diplomat.

Enums§

AttributeContext
Where the attribute was found. Some attributes are only allowed in some contexts (e.g. namespaces cannot be specified on methods)
FloatType
32 and 64-bit floating point numbers.
InputOrOutput
Directionality of the type
Int128Type
128-bit signed and unsigned integers.
IntSizeType
Platform-dependent signed and unsigned size types.
IntType
8, 16, 32, and 64-bit signed and unsigned integers.
LoweringError
An error from lowering the AST to the HIR.
MaybeOwn
Determine whether a pointer to an opaque type is owned or borrowed.
MaybeStatic
Wrapper type for Lifetime and Lifetime, indicating that it may be the 'static lifetime.
NoCallback
NoTraitPath
Non-instantiable enum to denote the trait path in TyPositions that don’t allow traits (anything not InputOnly)
PrimitiveType
All primitive types.
ReturnType
Whether or not the method returns a value or a result.
ReturnableStructDef
ReturnableStructPath
Path to a struct that may appear as an output.
SelfType
Type that can appear in the self position.
Slice
SpecialMethod
Attributes that mark methods as “special”
SuccessType
Type that the method returns.
SymbolId
Type
Type that may be used as input or output.
TypeDef
TypeId

Traits§

AttributeValidator
Defined by backends when validating attributes
CallbackInstantiationFunctionality
OpaqueOwner
Abstraction over how a type can hold a pointer to an opaque.
StructPathLike
TraitIdGetter
TyPosition
Abstraction over where a type can appear in a function signature.

Type Aliases§

ErrorAndContext
Ident
Borrowed checked string containing a Rust identifier.
IdentBuf
Owned checked string containing a Rust identifier.
OutStructDef
Structs that can only be returned from methods.
OutStructField
A field on a [OutStruct]s.
OutStructPath
Path to a struct that can only be used as an output.
OutType
Type that can only be used as an output.