Expand description
Owned (lifetime-free) versions of all AST types.
Arena-allocated types (Program<'arena, 'src>, etc.) cannot be stored in a
struct alongside the bumpalo::Bump arena that owns them — the borrow checker
rejects the self-referential pattern. These owned mirrors solve that: they use
Box<str> instead of &str, Box<[T]> instead of ArenaVec<'arena, T>, and
Box<T> instead of &'arena T. The result is 'static — no lifetime
parameters, storeable in a HashMap, sendable across threads.
Serialization is byte-for-byte identical to the arena types so existing JSON snapshots remain valid.
§Entry points
Call [php_rs_parser::parse()] — it returns a [php_rs_parser::ParseResult]
whose .program field is an owned Program. To convert an
arena-allocated Program directly, use
to_owned_program.
Re-exports§
pub use fold::fold_owned_arg;pub use fold::fold_owned_attribute;pub use fold::fold_owned_catch_clause;pub use fold::fold_owned_class_member;pub use fold::fold_owned_closure_use_var;pub use fold::fold_owned_enum_member;pub use fold::fold_owned_expr;pub use fold::fold_owned_match_arm;pub use fold::fold_owned_name;pub use fold::fold_owned_param;pub use fold::fold_owned_program;pub use fold::fold_owned_property_hook;pub use fold::fold_owned_stmt;pub use fold::fold_owned_type_hint;pub use fold::FoldOwned;pub use visitor::walk_owned_arg;pub use visitor::walk_owned_attribute;pub use visitor::walk_owned_catch_clause;pub use visitor::walk_owned_class_member;pub use visitor::walk_owned_comments;pub use visitor::walk_owned_enum_member;pub use visitor::walk_owned_expr;pub use visitor::walk_owned_match_arm;pub use visitor::walk_owned_name;pub use visitor::walk_owned_param;pub use visitor::walk_owned_program;pub use visitor::walk_owned_property_hook;pub use visitor::walk_owned_stmt;pub use visitor::walk_owned_trait_use;pub use visitor::walk_owned_type_hint;pub use visitor::OwnedScope;pub use visitor::OwnedScopeVisitor;pub use visitor::OwnedScopeWalker;pub use visitor::OwnedVisitor;
Modules§
- fold
- Owned AST transformation via the
FoldOwnedtrait. - visitor
- Visitor infrastructure for owned (lifetime-free) PHP AST traversal.
Structs§
- Arg
- Array
Access Expr - Array
Element - Arrow
Function Expr - Assign
Expr - Attribute
- Binary
Expr - Block
- Owned mirror of
crate::ast::Block— a brace-delimited statement block. - Callable
Create Expr - Catch
Clause - Class
Body - Class
Const Decl - Class
Decl - Class
Member - Closure
Expr - Closure
UseVar - Comment
- Const
Item - Declare
Stmt - DoWhile
Stmt - Else
IfBranch - Enum
Body - Enum
Case - Enum
Decl - Enum
Member - Expr
- ForStmt
- Foreach
Stmt - Function
Call Expr - Function
Decl - IfStmt
- Interface
Decl - Match
Arm - Match
Expr - Method
Call Expr - Method
Decl - Name
- Namespace
Decl - NewExpr
- Null
Coalesce Expr - Param
- Program
- Property
Access Expr - Property
Decl - Property
Hook - Static
Access Expr - Static
DynMethod Call Expr - Static
Method Call Expr - Static
Var - Stmt
- Switch
Body - Switch
Case - Switch
Stmt - Ternary
Expr - Trait
Adaptation - Trait
Decl - Trait
UseDecl - TryCatch
Stmt - Type
Hint - Unary
Postfix Expr - Unary
Prefix Expr - UseDecl
- UseItem
- While
Stmt - Yield
Expr
Enums§
- Callable
Create Kind - Class
Member Kind - Enum
Member Kind - Expr
Kind - Namespace
Body - Property
Hook Body - Stmt
Kind - String
Part - Trait
Adaptation Kind - Type
Hint Kind
Functions§
- from_
owned_ program - Convert an owned
Programinto an arena-allocatedProgram. - to_
owned_ expr - Convert an arena-allocated
Exprinto anExpr. - to_
owned_ name - Convert an arena-allocated
Nameinto aName. - to_
owned_ program - Convert an arena-allocated
Programinto aProgram. - to_
owned_ stmt - Convert an arena-allocated
Stmtinto aStmt. - to_
owned_ type_ hint - Convert an arena-allocated
TypeHintinto aTypeHint.