pub struct SchemaMethod {
pub name: String,
pub name_range: TokenRange,
pub generics: Vec<String>,
pub params: Vec<SchemaMethodParam>,
pub return_type: TypeNode,
pub body: Option<Box<Node>>,
pub derives: Vec<String>,
pub is_native: bool,
pub is_private: bool,
pub range: TokenRange,
pub doc_comment: Option<String>,
}Expand description
A method declaration inside a schema’s with { ... } block.
Source form: [#derive C ...]* [#native] name(p1: T1, ...) -> R [: body]
— the body is required when is_native is false and forbidden when it
is true (parser enforces this).
Fields§
§name: StringMethod name (the name in name(...) -> R).
name_range: TokenRange§generics: Vec<String>Method-level generic type parameter names (e.g. ["U"] for
map<U>(...)). Empty for monomorphic methods. Each occurrence
inside params[i].type_node or return_type is a placeholder
instantiated at the call site, on top of any schema-level
placeholders already in scope.
params: Vec<SchemaMethodParam>Typed parameters as written; self is implicit and is added by
the analyzer when lowering.
return_type: TypeNodeReturn type (the R in -> R). Required for every method —
methods are not type-inferred at the signature level.
body: Option<Box<Node>>Body expression (: body). None when the method is marked
#native — the host registers the implementation.
derives: Vec<String>Constraint names from method-level #derive <Constraint> pragmas,
in source order.
is_native: boolTrue when an #native pragma precedes this method, indicating
the body lives in host Rust (registered via the schema-method
host API). The parser leaves body None in this case.
is_private: boolTrue when a #internal pragma precedes this method. Internal
methods are visible only from other method bodies on the same
schema; script-level value.method() calls fail with
MethodNotFound at the analyzer stage.
range: TokenRange§doc_comment: Option<String>Trait Implementations§
Source§impl Clone for SchemaMethod
impl Clone for SchemaMethod
Source§fn clone(&self) -> SchemaMethod
fn clone(&self) -> SchemaMethod
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchemaMethod
impl Debug for SchemaMethod
Source§impl PartialEq for SchemaMethod
impl PartialEq for SchemaMethod
Source§fn eq(&self, other: &SchemaMethod) -> bool
fn eq(&self, other: &SchemaMethod) -> bool
self and other values to be equal, and is used by ==.