Skip to main content

concatenation

Trait concatenation 

Source
pub trait concatenation {
    // Provided method
    fn __concat(&self, other: any) -> any { ... }
}
Expand description

Metamethod controlling the concatenation operator.

Provided Methods§

Source

fn __concat(&self, other: any) -> any

The concatenation (..) operation. Invoked whenever an operand is neither a string nor a number.

§Examples
local mt = { __concat = function(a, b) return "<" .. a.tag .. b .. ">" end }
local x = setmetatable({ tag = "x" }, mt)
print(x .. "!")    --> <x!>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§