Struct starlark::values::function::NativeAttribute [−][src]
pub struct NativeAttribute { /* fields omitted */ }
Expand description
Used by the #[attribute]
tag of #[starlark_module]
to define a function that pretends to be an attribute.
Implementations
Trait Implementations
Must return the TypeId
of Self
but where the lifetimes are changed
to 'static
. Must be consistent with static_type_of
. Read more
Must return the TypeId
of Self
but where the lifetimes are changed
to 'static
. Must be consistent with static_type_id
. Must not
consult the self
parameter in any way. Read more
Return a string describing the type of self, as returned by the type() function. Read more
Like get_type, but returns a reusable FrozenValue
pointer to it.
This function deliberately doesn’t take a heap, as it would not be performant
to allocate a new value each time. Read more
Directly invoke a function.
The number of named
and names
arguments are guaranteed to be equal.
A direct implementation is responsible for calling Evaluator::with_call_stack
to ensure
the call stack is properly updated. Read more
Is this value a match for a named type. Usually returns true
for
values matching get_type
, but might also work for subtypes it implements. Read more
Get the members associated with this type, accessible via this_type.x
.
These members will have dir
/getattr
/hasattr
properly implemented,
so it is the preferred way to go if possible. See
GlobalsStatic
for an example of how
to define this method. Read more
Return structured documentation for self, if available.
Return a string representation of self, as returned by the repr()
function.
Defaults to the Debug
instance, but most types should override this method.
In many cases the repr()
representation will also be a Starlark expression
for creating the value. Read more
Convert self to a integer value, as returned by the int() function if the type is numeric (not for string). Works for int and bool (0 = false, 1 = true). Read more
Compare self
with other
for equality.
Should only return an error on excessive recursion. Read more
Return the result of a[index]
if a
is indexable.
Extract a slice of the underlying object if the object is indexable. The
result will be object between start
and stop
(both of them are
added length() if negative and then clamped between 0 and length()).
stride
indicates the direction. Read more
Returns an iterable over the value of this container if this value holds an iterable container. Read more
Get an attribute for the current value as would be returned by dotted
expression (i.e. a.attribute
). Read more
Return true if an attribute of name attribute
exists for the current
value. Read more
Return a vector of string listing all attribute of the current value. Read more
Tell wether other
is in the current value, if it is a container. Read more
Apply the +
unary operator to the current value. Read more
Apply the -
unary operator to the current value. Read more
Add other
to the current value. Pass both self and
the Value form of self as original. Read more
Substract other
from the current value. Read more
Multiply the current value with other
. Read more
Apply the percent operator between the current value and other
. Usually used on
strings, as per
the Starlark spec. Read more
Floor division between the current value and other
. Read more
Bitwise <<
operator.
Bitwise >>
operator.
Called when exporting a value under a specific name,
Set the value at index
with the new value. Read more