pub trait Concatenate {
// Required method
fn concat(self, other: Self) -> Result<Self, MinarrowError>
where Self: Sized;
}Expand description
Concatenate trait for combining two instances of the same type.
§Consuming Semantics
This trait consumes both self and other for maximum efficiency.
The first array’s buffer is reused and the second array’s data is appended.
If you need to preserve the original arrays, clone them before calling concat.
Implementors must ensure:
- Type compatibility (must be same or compatible types)
- Shape validation where applicable (e.g., tables, cubes, matrices)
- Field/schema compatibility for structured types
Returns Result<Self, MinarrowError> where Self is the concatenated result.
Required Methods§
Sourcefn concat(self, other: Self) -> Result<Self, MinarrowError>where
Self: Sized,
fn concat(self, other: Self) -> Result<Self, MinarrowError>where
Self: Sized,
Concatenates self with other, consuming both and returning a new instance.
§Ownership
Both self and other are moved and cannot be used afterward.
To preserve an array, clone it first: arr1.clone().concat(arr2).
§Errors
TypeError: Incompatible types that cannot be concatenatedShapeError: Shape mismatch (for tables, cubes, matrices)IncompatibleTypeError: Schema/field mismatch (for structured types)
§Example
let v1 = Vec64::from(vec![1, 2, 3]);
let v2 = Vec64::from(vec![4, 5, 6]);
let result = v1.concat(v2).unwrap(); // v1 and v2 are now consumed
assert_eq!(result.as_slice(), &[1, 2, 3, 4, 5, 6]);Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".