diff --git a/docs/rust/.rustc_info.json b/docs/rust/.rustc_info.json index a7e97a421a..30a01191aa 100644 --- a/docs/rust/.rustc_info.json +++ b/docs/rust/.rustc_info.json @@ -1 +1 @@ -{"rustc_fingerprint":11803740732973618980,"outputs":{"16992575326180275217":{"success":true,"status":"","code":0,"stdout":"rustc 1.83.0-nightly (d6c8169c1 2024-09-03)\nbinary: rustc\ncommit-hash: d6c8169c186ab16a3404cd0d0866674018e8a19e\ncommit-date: 2024-09-03\nhost: x86_64-unknown-linux-gnu\nrelease: 1.83.0-nightly\nLLVM version: 19.1.0\n","stderr":""},"16328442174039370641":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/runner/.rustup/toolchains/nightly-2024-09-04-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file +{"rustc_fingerprint":9157450911426878847,"outputs":{"16328442174039370641":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/runner/.rustup/toolchains/nightly-2024-09-04-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\nfmt_debug=\"full\"\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"unknown\"\nub_checks\nunix\n","stderr":""},"16992575326180275217":{"success":true,"status":"","code":0,"stdout":"rustc 1.83.0-nightly (d6c8169c1 2024-09-03)\nbinary: rustc\ncommit-hash: d6c8169c186ab16a3404cd0d0866674018e8a19e\ncommit-date: 2024-09-03\nhost: x86_64-unknown-linux-gnu\nrelease: 1.83.0-nightly\nLLVM version: 19.1.0\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/docs/rust/doc/help.html b/docs/rust/doc/help.html index 7cada964ac..8662a83413 100644 --- a/docs/rust/doc/help.html +++ b/docs/rust/doc/help.html @@ -1 +1 @@ -
Self
from the given unstructured data. Read moreSelf
from the entirety of the given\nunstructured data. Read moreOverwrites the contents of self
with a clone of the contents of source
.
This method is preferred over simply assigning source.clone()
to self
,\nas it avoids reallocation if possible. Additionally, if the element type\nT
overrides clone_from()
, this will reuse the resources of self
’s\nelements as well.
let x = vec![5, 6, 7];\nlet mut y = vec![8, 9, 10];\nlet yp: *const i32 = y.as_ptr();\n\ny.clone_from(&x);\n\n// The value is the same\nassert_eq!(x, y);\n\n// And no reallocation occurred\nassert_eq!(yp, y.as_ptr());
cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]Extend implementation that copies elements out of references before pushing them onto the Vec.
\nThis implementation is specialized for slice iterators, where it uses copy_from_slice
to\nappend the entire slice at once.
extend_one
)extend_one
)extend_one
)extend_one
)Converts a BinaryHeap<T>
into a Vec<T>
.
This conversion requires no data movement or allocation, and has\nconstant time complexity.
\nConverts a clone-on-write slice into a vector.
\nIf s
already owns a Vec<T>
, it will be returned directly.\nIf s
is borrowing a slice, a new Vec<T>
will be allocated and\nfilled by cloning s
’s items into it.
let o: Cow<'_, [i32]> = Cow::Owned(vec![1, 2, 3]);\nlet b: Cow<'_, [i32]> = Cow::Borrowed(&[1, 2, 3]);\nassert_eq!(Vec::from(o), Vec::from(b));
Turn a VecDeque<T>
into a Vec<T>
.
This never needs to re-allocate, but does need to do O(n) data movement if\nthe circular buffer doesn’t happen to be at the beginning of the allocation.
\nuse std::collections::VecDeque;\n\n// This one is *O*(1).\nlet deque: VecDeque<_> = (1..5).collect();\nlet ptr = deque.as_slices().0.as_ptr();\nlet vec = Vec::from(deque);\nassert_eq!(vec, [1, 2, 3, 4]);\nassert_eq!(vec.as_ptr(), ptr);\n\n// This one needs data rearranging.\nlet mut deque: VecDeque<_> = (1..5).collect();\ndeque.push_front(9);\ndeque.push_front(8);\nlet ptr = deque.as_slices().1.as_ptr();\nlet vec = Vec::from(deque);\nassert_eq!(vec, [8, 9, 1, 2, 3, 4]);\nassert_eq!(vec.as_ptr(), ptr);
Collects an iterator into a Vec, commonly called via Iterator::collect()
In general Vec
does not guarantee any particular growth or allocation strategy.\nThat also applies to this trait impl.
Note: This section covers implementation details and is therefore exempt from\nstability guarantees.
\nVec may use any or none of the following strategies,\ndepending on the supplied iterator:
\nIterator::size_hint()
\npushing
one item at a timeThe last case warrants some attention. It is an optimization that in many cases reduces peak memory\nconsumption and improves cache locality. But when big, short-lived allocations are created,\nonly a small fraction of their items get collected, no further use is made of the spare capacity\nand the resulting Vec
is moved into a longer-lived structure, then this can lead to the large\nallocations having their lifetimes unnecessarily extended which can result in increased memory\nfootprint.
In cases where this is an issue, the excess capacity can be discarded with Vec::shrink_to()
,\nVec::shrink_to_fit()
or by collecting into Box<[T]>
instead, which additionally reduces\nthe size of the long-lived struct.
static LONG_LIVED: Mutex<Vec<Vec<u16>>> = Mutex::new(Vec::new());\n\nfor i in 0..10 {\n let big_temporary: Vec<u16> = (0..1024).collect();\n // discard most items\n let mut result: Vec<_> = big_temporary.into_iter().filter(|i| i % 100 == 0).collect();\n // without this a lot of unused capacity might be moved into the global\n result.shrink_to_fit();\n LONG_LIVED.lock().unwrap().push(result);\n}
The hash of a vector is the same as that of the corresponding slice,\nas required by the core::borrow::Borrow
implementation.
use std::hash::BuildHasher;\n\nlet b = std::hash::RandomState::new();\nlet v: Vec<u8> = vec![0xa8, 0x3c, 0x09];\nlet s: &[u8] = &[0xa8, 0x3c, 0x09];\nassert_eq!(b.hash_one(v), b.hash_one(s));
Creates a consuming iterator, that is, one that moves each value out of\nthe vector (from start to end). The vector cannot be used after calling\nthis.
\nlet v = vec![\"a\".to_string(), \"b\".to_string()];\nlet mut v_iter = v.into_iter();\n\nlet first_element: Option<String> = v_iter.next();\n\nassert_eq!(first_element, Some(\"a\".to_string()));\nassert_eq!(v_iter.next(), Some(\"b\".to_string()));\nassert_eq!(v_iter.next(), None);
MaybeOwnedMut
].IoSliceMut
]s of the buffers. Read moreImplements ordering of vectors, lexicographically.
\nImplements comparison of vectors, lexicographically.
\nlen
is less than the current length, nothing\nshould happen. Read moreSink
to receive a value. Read morepoll_ready
which returned Poll::Ready(Ok(()))
. Read moreConstructs a new, empty Vec<T>
.
The vector will not allocate until elements are pushed onto it.
\nlet mut vec: Vec<i32> = Vec::new();
Constructs a new, empty Vec<T>
with at least the specified capacity.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
It is important to note that although the returned vector has the\nminimum capacity specified, the vector will have a zero length. For\nan explanation of the difference between length and capacity, see\nCapacity and reallocation.
\nIf it is important to know the exact allocated capacity of a Vec
,\nalways use the capacity
method after construction.
For Vec<T>
where T
is a zero-sized type, there will be no allocation\nand the capacity will always be usize::MAX
.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = Vec::with_capacity(10);\n\n// The vector contains no items, even though it has capacity for more\nassert_eq!(vec.len(), 0);\nassert!(vec.capacity() >= 10);\n\n// These are all done without reallocating...\nfor i in 0..10 {\n vec.push(i);\n}\nassert_eq!(vec.len(), 10);\nassert!(vec.capacity() >= 10);\n\n// ...but this may make the vector reallocate\nvec.push(11);\nassert_eq!(vec.len(), 11);\nassert!(vec.capacity() >= 11);\n\n// A vector of a zero-sized type will always over-allocate, since no\n// allocation is necessary\nlet vec_units = Vec::<()>::with_capacity(10);\nassert_eq!(vec_units.capacity(), usize::MAX);
try_with_capacity
)Constructs a new, empty Vec<T>
with at least the specified capacity.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
Returns an error if the capacity exceeds isize::MAX
bytes,\nor if the allocator reports allocation failure.
Creates a Vec<T>
directly from a pointer, a length, and a capacity.
This is highly unsafe, due to the number of invariants that aren’t\nchecked:
\nptr
must have been allocated using the global allocator, such as via\nthe alloc::alloc
function.T
needs to have the same alignment as what ptr
was allocated with.\n(T
having a less strict alignment is not sufficient, the alignment really\nneeds to be equal to satisfy the dealloc
requirement that memory must be\nallocated and deallocated with the same layout.)T
times the capacity
(ie. the allocated size in bytes) needs\nto be the same size as the pointer was allocated with. (Because similar to\nalignment, dealloc
must be called with the same layout size
.)length
needs to be less than or equal to capacity
.length
values must be properly initialized values of type T
.capacity
needs to be the capacity that the pointer was allocated with.isize::MAX
.\nSee the safety documentation of pointer::offset
.These requirements are always upheld by any ptr
that has been allocated\nvia Vec<T>
. Other allocation sources are allowed if the invariants are\nupheld.
Violating these may cause problems like corrupting the allocator’s\ninternal data structures. For example it is normally not safe\nto build a Vec<u8>
from a pointer to a C char
array with length\nsize_t
, doing so is only safe if the array was initially allocated by\na Vec
or String
.\nIt’s also not safe to build one from a Vec<u16>
and its length, because\nthe allocator cares about the alignment, and these two types have different\nalignments. The buffer was allocated with alignment 2 (for u16
), but after\nturning it into a Vec<u8>
it’ll be deallocated with alignment 1. To avoid\nthese issues, it is often preferable to do casting/transmuting using\nslice::from_raw_parts
instead.
The ownership of ptr
is effectively transferred to the\nVec<T>
which may then deallocate, reallocate or change the\ncontents of memory pointed to by the pointer at will. Ensure\nthat nothing else uses the pointer after calling this\nfunction.
use std::ptr;\nuse std::mem;\n\nlet v = vec![1, 2, 3];\n\n// Prevent running `v`'s destructor so we are in complete control\n// of the allocation.\nlet mut v = mem::ManuallyDrop::new(v);\n\n// Pull out the various important pieces of information about `v`\nlet p = v.as_mut_ptr();\nlet len = v.len();\nlet cap = v.capacity();\n\nunsafe {\n // Overwrite memory with 4, 5, 6\n for i in 0..len {\n ptr::write(p.add(i), 4 + i);\n }\n\n // Put everything back together into a Vec\n let rebuilt = Vec::from_raw_parts(p, len, cap);\n assert_eq!(rebuilt, [4, 5, 6]);\n}
Using memory that was allocated elsewhere:
\n\nuse std::alloc::{alloc, Layout};\n\nfn main() {\n let layout = Layout::array::<u32>(16).expect(\"overflow cannot happen\");\n\n let vec = unsafe {\n let mem = alloc(layout).cast::<u32>();\n if mem.is_null() {\n return;\n }\n\n mem.write(1_000_000);\n\n Vec::from_raw_parts(mem, 1, 16)\n };\n\n assert_eq!(vec, &[1_000_000]);\n assert_eq!(vec.capacity(), 16);\n}
Resizes the Vec
in-place so that len
is equal to new_len
.
If new_len
is greater than len
, the Vec
is extended by the\ndifference, with each additional slot filled with value
.\nIf new_len
is less than len
, the Vec
is simply truncated.
This method requires T
to implement Clone
,\nin order to be able to clone the passed value.\nIf you need more flexibility (or want to rely on Default
instead of\nClone
), use Vec::resize_with
.\nIf you only need to resize to a smaller size, use Vec::truncate
.
let mut vec = vec![\"hello\"];\nvec.resize(3, \"world\");\nassert_eq!(vec, [\"hello\", \"world\", \"world\"]);\n\nlet mut vec = vec![1, 2, 3, 4];\nvec.resize(2, 0);\nassert_eq!(vec, [1, 2]);
Clones and appends all elements in a slice to the Vec
.
Iterates over the slice other
, clones each element, and then appends\nit to this Vec
. The other
slice is traversed in-order.
Note that this function is same as extend
except that it is\nspecialized to work with slices instead. If and when Rust gets\nspecialization this function will likely be deprecated (but still\navailable).
let mut vec = vec![1];\nvec.extend_from_slice(&[2, 3, 4]);\nassert_eq!(vec, [1, 2, 3, 4]);
Copies elements from src
range to the end of the vector.
Panics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nlet mut vec = vec![0, 1, 2, 3, 4];\n\nvec.extend_from_within(2..);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);\n\nvec.extend_from_within(..2);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);\n\nvec.extend_from_within(4..8);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);
Creates a splicing iterator that replaces the specified range in the vector\nwith the given replace_with
iterator and yields the removed items.\nreplace_with
does not need to be the same length as range
.
range
is removed even if the iterator is not consumed until the end.
It is unspecified how many elements are removed from the vector\nif the Splice
value is leaked.
The input iterator replace_with
is only consumed when the Splice
value is dropped.
This is optimal if:
\nrange
) is empty,replace_with
yields fewer or equal elements than range
’s lengthsize_hint()
is exact.Otherwise, a temporary vector is allocated and the tail is moved twice.
\nPanics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nlet mut v = vec![1, 2, 3, 4];\nlet new = [7, 8, 9];\nlet u: Vec<_> = v.splice(1..3, new).collect();\nassert_eq!(v, &[1, 7, 8, 9, 4]);\nassert_eq!(u, &[2, 3]);
extract_if
)Creates an iterator which uses a closure to determine if an element should be removed.
\nIf the closure returns true, then the element is removed and yielded.\nIf the closure returns false, the element will remain in the vector and will not be yielded\nby the iterator.
\nIf the returned ExtractIf
is not exhausted, e.g. because it is dropped without iterating\nor the iteration short-circuits, then the remaining elements will be retained.\nUse retain
with a negated predicate if you do not need the returned iterator.
Using this method is equivalent to the following code:
\n\nlet mut i = 0;\nwhile i < vec.len() {\n if some_predicate(&mut vec[i]) {\n let val = vec.remove(i);\n // your code here\n } else {\n i += 1;\n }\n}\n
But extract_if
is easier to use. extract_if
is also more efficient,\nbecause it can backshift the elements of the array in bulk.
Note that extract_if
also lets you mutate every element in the filter closure,\nregardless of whether you choose to keep or remove it.
Splitting an array into evens and odds, reusing the original allocation:
\n\n#![feature(extract_if)]\nlet mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];\n\nlet evens = numbers.extract_if(|x| *x % 2 == 0).collect::<Vec<_>>();\nlet odds = numbers;\n\nassert_eq!(evens, vec![2, 4, 6, 8, 14]);\nassert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);
allocator_api
)Constructs a new, empty Vec<T, A>
.
The vector will not allocate until elements are pushed onto it.
\n#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut vec: Vec<i32, _> = Vec::new_in(System);
allocator_api
)Constructs a new, empty Vec<T, A>
with at least the specified capacity\nwith the provided allocator.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
It is important to note that although the returned vector has the\nminimum capacity specified, the vector will have a zero length. For\nan explanation of the difference between length and capacity, see\nCapacity and reallocation.
\nIf it is important to know the exact allocated capacity of a Vec
,\nalways use the capacity
method after construction.
For Vec<T, A>
where T
is a zero-sized type, there will be no allocation\nand the capacity will always be usize::MAX
.
Panics if the new capacity exceeds isize::MAX
bytes.
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut vec = Vec::with_capacity_in(10, System);\n\n// The vector contains no items, even though it has capacity for more\nassert_eq!(vec.len(), 0);\nassert!(vec.capacity() >= 10);\n\n// These are all done without reallocating...\nfor i in 0..10 {\n vec.push(i);\n}\nassert_eq!(vec.len(), 10);\nassert!(vec.capacity() >= 10);\n\n// ...but this may make the vector reallocate\nvec.push(11);\nassert_eq!(vec.len(), 11);\nassert!(vec.capacity() >= 11);\n\n// A vector of a zero-sized type will always over-allocate, since no\n// allocation is necessary\nlet vec_units = Vec::<(), System>::with_capacity_in(10, System);\nassert_eq!(vec_units.capacity(), usize::MAX);
allocator_api
)Constructs a new, empty Vec<T, A>
with at least the specified capacity\nwith the provided allocator.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
Returns an error if the capacity exceeds isize::MAX
bytes,\nor if the allocator reports allocation failure.
allocator_api
)Creates a Vec<T, A>
directly from a pointer, a length, a capacity,\nand an allocator.
This is highly unsafe, due to the number of invariants that aren’t\nchecked:
\nptr
must be currently allocated via the given allocator alloc
.T
needs to have the same alignment as what ptr
was allocated with.\n(T
having a less strict alignment is not sufficient, the alignment really\nneeds to be equal to satisfy the dealloc
requirement that memory must be\nallocated and deallocated with the same layout.)T
times the capacity
(ie. the allocated size in bytes) needs\nto be the same size as the pointer was allocated with. (Because similar to\nalignment, dealloc
must be called with the same layout size
.)length
needs to be less than or equal to capacity
.length
values must be properly initialized values of type T
.capacity
needs to fit the layout size that the pointer was allocated with.isize::MAX
.\nSee the safety documentation of pointer::offset
.These requirements are always upheld by any ptr
that has been allocated\nvia Vec<T, A>
. Other allocation sources are allowed if the invariants are\nupheld.
Violating these may cause problems like corrupting the allocator’s\ninternal data structures. For example it is not safe\nto build a Vec<u8>
from a pointer to a C char
array with length size_t
.\nIt’s also not safe to build one from a Vec<u16>
and its length, because\nthe allocator cares about the alignment, and these two types have different\nalignments. The buffer was allocated with alignment 2 (for u16
), but after\nturning it into a Vec<u8>
it’ll be deallocated with alignment 1.
The ownership of ptr
is effectively transferred to the\nVec<T>
which may then deallocate, reallocate or change the\ncontents of memory pointed to by the pointer at will. Ensure\nthat nothing else uses the pointer after calling this\nfunction.
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nuse std::ptr;\nuse std::mem;\n\nlet mut v = Vec::with_capacity_in(3, System);\nv.push(1);\nv.push(2);\nv.push(3);\n\n// Prevent running `v`'s destructor so we are in complete control\n// of the allocation.\nlet mut v = mem::ManuallyDrop::new(v);\n\n// Pull out the various important pieces of information about `v`\nlet p = v.as_mut_ptr();\nlet len = v.len();\nlet cap = v.capacity();\nlet alloc = v.allocator();\n\nunsafe {\n // Overwrite memory with 4, 5, 6\n for i in 0..len {\n ptr::write(p.add(i), 4 + i);\n }\n\n // Put everything back together into a Vec\n let rebuilt = Vec::from_raw_parts_in(p, len, cap, alloc.clone());\n assert_eq!(rebuilt, [4, 5, 6]);\n}
Using memory that was allocated elsewhere:
\n\n#![feature(allocator_api)]\n\nuse std::alloc::{AllocError, Allocator, Global, Layout};\n\nfn main() {\n let layout = Layout::array::<u32>(16).expect(\"overflow cannot happen\");\n\n let vec = unsafe {\n let mem = match Global.allocate(layout) {\n Ok(mem) => mem.cast::<u32>().as_ptr(),\n Err(AllocError) => return,\n };\n\n mem.write(1_000_000);\n\n Vec::from_raw_parts_in(mem, 1, 16, Global)\n };\n\n assert_eq!(vec, &[1_000_000]);\n assert_eq!(vec.capacity(), 16);\n}
vec_into_raw_parts
)Decomposes a Vec<T>
into its raw components: (pointer, length, capacity)
.
Returns the raw pointer to the underlying data, the length of\nthe vector (in elements), and the allocated capacity of the\ndata (in elements). These are the same arguments in the same\norder as the arguments to from_raw_parts
.
After calling this function, the caller is responsible for the\nmemory previously managed by the Vec
. The only way to do\nthis is to convert the raw pointer, length, and capacity back\ninto a Vec
with the from_raw_parts
function, allowing\nthe destructor to perform the cleanup.
#![feature(vec_into_raw_parts)]\nlet v: Vec<i32> = vec![-1, 0, 1];\n\nlet (ptr, len, cap) = v.into_raw_parts();\n\nlet rebuilt = unsafe {\n // We can now make changes to the components, such as\n // transmuting the raw pointer to a compatible type.\n let ptr = ptr as *mut u32;\n\n Vec::from_raw_parts(ptr, len, cap)\n};\nassert_eq!(rebuilt, [4294967295, 0, 1]);
allocator_api
)Decomposes a Vec<T>
into its raw components: (pointer, length, capacity, allocator)
.
Returns the raw pointer to the underlying data, the length of the vector (in elements),\nthe allocated capacity of the data (in elements), and the allocator. These are the same\narguments in the same order as the arguments to from_raw_parts_in
.
After calling this function, the caller is responsible for the\nmemory previously managed by the Vec
. The only way to do\nthis is to convert the raw pointer, length, and capacity back\ninto a Vec
with the from_raw_parts_in
function, allowing\nthe destructor to perform the cleanup.
#![feature(allocator_api, vec_into_raw_parts)]\n\nuse std::alloc::System;\n\nlet mut v: Vec<i32, System> = Vec::new_in(System);\nv.push(-1);\nv.push(0);\nv.push(1);\n\nlet (ptr, len, cap, alloc) = v.into_raw_parts_with_alloc();\n\nlet rebuilt = unsafe {\n // We can now make changes to the components, such as\n // transmuting the raw pointer to a compatible type.\n let ptr = ptr as *mut u32;\n\n Vec::from_raw_parts_in(ptr, len, cap, alloc)\n};\nassert_eq!(rebuilt, [4294967295, 0, 1]);
Returns the total number of elements the vector can hold without\nreallocating.
\nlet mut vec: Vec<i32> = Vec::with_capacity(10);\nvec.push(42);\nassert!(vec.capacity() >= 10);
Reserves capacity for at least additional
more elements to be inserted\nin the given Vec<T>
. The collection may reserve more space to\nspeculatively avoid frequent reallocations. After calling reserve
,\ncapacity will be greater than or equal to self.len() + additional
.\nDoes nothing if capacity is already sufficient.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1];\nvec.reserve(10);\nassert!(vec.capacity() >= 11);
Reserves the minimum capacity for at least additional
more elements to\nbe inserted in the given Vec<T>
. Unlike reserve
, this will not\ndeliberately over-allocate to speculatively avoid frequent allocations.\nAfter calling reserve_exact
, capacity will be greater than or equal to\nself.len() + additional
. Does nothing if the capacity is already\nsufficient.
Note that the allocator may give the collection more space than it\nrequests. Therefore, capacity can not be relied upon to be precisely\nminimal. Prefer reserve
if future insertions are expected.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1];\nvec.reserve_exact(10);\nassert!(vec.capacity() >= 11);
Tries to reserve capacity for at least additional
more elements to be inserted\nin the given Vec<T>
. The collection may reserve more space to speculatively avoid\nfrequent reallocations. After calling try_reserve
, capacity will be\ngreater than or equal to self.len() + additional
if it returns\nOk(())
. Does nothing if capacity is already sufficient. This method\npreserves the contents even if an error occurs.
If the capacity overflows, or the allocator reports a failure, then an error\nis returned.
\nuse std::collections::TryReserveError;\n\nfn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {\n let mut output = Vec::new();\n\n // Pre-reserve the memory, exiting if we can't\n output.try_reserve(data.len())?;\n\n // Now we know this can't OOM in the middle of our complex work\n output.extend(data.iter().map(|&val| {\n val * 2 + 5 // very complicated\n }));\n\n Ok(output)\n}
Tries to reserve the minimum capacity for at least additional
\nelements to be inserted in the given Vec<T>
. Unlike try_reserve
,\nthis will not deliberately over-allocate to speculatively avoid frequent\nallocations. After calling try_reserve_exact
, capacity will be greater\nthan or equal to self.len() + additional
if it returns Ok(())
.\nDoes nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it\nrequests. Therefore, capacity can not be relied upon to be precisely\nminimal. Prefer try_reserve
if future insertions are expected.
If the capacity overflows, or the allocator reports a failure, then an error\nis returned.
\nuse std::collections::TryReserveError;\n\nfn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {\n let mut output = Vec::new();\n\n // Pre-reserve the memory, exiting if we can't\n output.try_reserve_exact(data.len())?;\n\n // Now we know this can't OOM in the middle of our complex work\n output.extend(data.iter().map(|&val| {\n val * 2 + 5 // very complicated\n }));\n\n Ok(output)\n}
Shrinks the capacity of the vector as much as possible.
\nThe behavior of this method depends on the allocator, which may either shrink the vector\nin-place or reallocate. The resulting vector might still have some excess capacity, just as\nis the case for with_capacity
. See Allocator::shrink
for more details.
let mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\nassert!(vec.capacity() >= 10);\nvec.shrink_to_fit();\nassert!(vec.capacity() >= 3);
Shrinks the capacity of the vector with a lower bound.
\nThe capacity will remain at least as large as both the length\nand the supplied value.
\nIf the current capacity is less than the lower limit, this is a no-op.
\nlet mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\nassert!(vec.capacity() >= 10);\nvec.shrink_to(4);\nassert!(vec.capacity() >= 4);\nvec.shrink_to(0);\nassert!(vec.capacity() >= 3);
Converts the vector into Box<[T]>
.
Before doing the conversion, this method discards excess capacity like shrink_to_fit
.
let v = vec![1, 2, 3];\n\nlet slice = v.into_boxed_slice();
Any excess capacity is removed:
\n\nlet mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\n\nassert!(vec.capacity() >= 10);\nlet slice = vec.into_boxed_slice();\nassert_eq!(slice.into_vec().capacity(), 3);
Shortens the vector, keeping the first len
elements and dropping\nthe rest.
If len
is greater or equal to the vector’s current length, this has\nno effect.
The drain
method can emulate truncate
, but causes the excess\nelements to be returned instead of dropped.
Note that this method has no effect on the allocated capacity\nof the vector.
\nTruncating a five element vector to two elements:
\n\nlet mut vec = vec![1, 2, 3, 4, 5];\nvec.truncate(2);\nassert_eq!(vec, [1, 2]);
No truncation occurs when len
is greater than the vector’s current\nlength:
let mut vec = vec![1, 2, 3];\nvec.truncate(8);\nassert_eq!(vec, [1, 2, 3]);
Truncating when len == 0
is equivalent to calling the clear
\nmethod.
let mut vec = vec![1, 2, 3];\nvec.truncate(0);\nassert_eq!(vec, []);
Extracts a slice containing the entire vector.
\nEquivalent to &s[..]
.
use std::io::{self, Write};\nlet buffer = vec![1, 2, 3, 5, 8];\nio::sink().write(buffer.as_slice()).unwrap();
Extracts a mutable slice of the entire vector.
\nEquivalent to &mut s[..]
.
use std::io::{self, Read};\nlet mut buffer = vec![0; 3];\nio::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();
Returns a raw pointer to the vector’s buffer, or a dangling raw pointer\nvalid for zero sized reads if the vector didn’t allocate.
\nThe caller must ensure that the vector outlives the pointer this\nfunction returns, or else it will end up dangling.\nModifying the vector may cause its buffer to be reallocated,\nwhich would also make any pointers to it invalid.
\nThe caller must also ensure that the memory the pointer (non-transitively) points to\nis never written to (except inside an UnsafeCell
) using this pointer or any pointer\nderived from it. If you need to mutate the contents of the slice, use as_mut_ptr
.
This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying slice, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr
and as_mut_ptr
.\nNote that calling other methods that materialize mutable references to the slice,\nor mutable references to specific elements you are planning on accessing through this pointer,\nas well as writing to those elements, may still invalidate this pointer.\nSee the second example below for how this guarantee can be used.
let x = vec![1, 2, 4];\nlet x_ptr = x.as_ptr();\n\nunsafe {\n for i in 0..x.len() {\n assert_eq!(*x_ptr.add(i), 1 << i);\n }\n}
Due to the aliasing guarantee, the following code is legal:
\n\nunsafe {\n let mut v = vec![0, 1, 2];\n let ptr1 = v.as_ptr();\n let _ = ptr1.read();\n let ptr2 = v.as_mut_ptr().offset(2);\n ptr2.write(2);\n // Notably, the write to `ptr2` did *not* invalidate `ptr1`\n // because it mutated a different element:\n let _ = ptr1.read();\n}
Returns a raw mutable pointer to the vector’s buffer, or a dangling\nraw pointer valid for zero sized reads if the vector didn’t allocate.
\nThe caller must ensure that the vector outlives the pointer this\nfunction returns, or else it will end up dangling.\nModifying the vector may cause its buffer to be reallocated,\nwhich would also make any pointers to it invalid.
\nThis method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying slice, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr
and as_mut_ptr
.\nNote that calling other methods that materialize references to the slice,\nor references to specific elements you are planning on accessing through this pointer,\nmay still invalidate this pointer.\nSee the second example below for how this guarantee can be used.
// Allocate vector big enough for 4 elements.\nlet size = 4;\nlet mut x: Vec<i32> = Vec::with_capacity(size);\nlet x_ptr = x.as_mut_ptr();\n\n// Initialize elements via raw pointer writes, then set length.\nunsafe {\n for i in 0..size {\n *x_ptr.add(i) = i as i32;\n }\n x.set_len(size);\n}\nassert_eq!(&*x, &[0, 1, 2, 3]);
Due to the aliasing guarantee, the following code is legal:
\n\nunsafe {\n let mut v = vec![0];\n let ptr1 = v.as_mut_ptr();\n ptr1.write(1);\n let ptr2 = v.as_mut_ptr();\n ptr2.write(2);\n // Notably, the write to `ptr2` did *not* invalidate `ptr1`:\n ptr1.write(3);\n}
allocator_api
)Returns a reference to the underlying allocator.
\nForces the length of the vector to new_len
.
This is a low-level operation that maintains none of the normal\ninvariants of the type. Normally changing the length of a vector\nis done using one of the safe operations instead, such as\ntruncate
, resize
, extend
, or clear
.
new_len
must be less than or equal to capacity()
.old_len..new_len
must be initialized.This method can be useful for situations in which the vector\nis serving as a buffer for other code, particularly over FFI:
\n\npub fn get_dictionary(&self) -> Option<Vec<u8>> {\n // Per the FFI method's docs, \"32768 bytes is always enough\".\n let mut dict = Vec::with_capacity(32_768);\n let mut dict_length = 0;\n // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:\n // 1. `dict_length` elements were initialized.\n // 2. `dict_length` <= the capacity (32_768)\n // which makes `set_len` safe to call.\n unsafe {\n // Make the FFI call...\n let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);\n if r == Z_OK {\n // ...and update the length to what was initialized.\n dict.set_len(dict_length);\n Some(dict)\n } else {\n None\n }\n }\n}
While the following example is sound, there is a memory leak since\nthe inner vectors were not freed prior to the set_len
call:
let mut vec = vec![vec![1, 0, 0],\n vec![0, 1, 0],\n vec![0, 0, 1]];\n// SAFETY:\n// 1. `old_len..0` is empty so no elements need to be initialized.\n// 2. `0 <= capacity` always holds whatever `capacity` is.\nunsafe {\n vec.set_len(0);\n}
Normally, here, one would use clear
instead to correctly drop\nthe contents and thus not leak memory.
Removes an element from the vector and returns it.
\nThe removed element is replaced by the last element of the vector.
\nThis does not preserve ordering of the remaining elements, but is O(1).\nIf you need to preserve the element order, use remove
instead.
Panics if index
is out of bounds.
let mut v = vec![\"foo\", \"bar\", \"baz\", \"qux\"];\n\nassert_eq!(v.swap_remove(1), \"bar\");\nassert_eq!(v, [\"foo\", \"qux\", \"baz\"]);\n\nassert_eq!(v.swap_remove(0), \"foo\");\nassert_eq!(v, [\"baz\", \"qux\"]);
Inserts an element at position index
within the vector, shifting all\nelements after it to the right.
Panics if index > len
.
let mut vec = vec![1, 2, 3];\nvec.insert(1, 4);\nassert_eq!(vec, [1, 4, 2, 3]);\nvec.insert(4, 5);\nassert_eq!(vec, [1, 4, 2, 3, 5]);
Takes O(Vec::len
) time. All items after the insertion index must be\nshifted to the right. In the worst case, all elements are shifted when\nthe insertion index is 0.
Removes and returns the element at position index
within the vector,\nshifting all elements after it to the left.
Note: Because this shifts over the remaining elements, it has a\nworst-case performance of O(n). If you don’t need the order of elements\nto be preserved, use swap_remove
instead. If you’d like to remove\nelements from the beginning of the Vec
, consider using\nVecDeque::pop_front
instead.
Panics if index
is out of bounds.
let mut v = vec![1, 2, 3];\nassert_eq!(v.remove(1), 2);\nassert_eq!(v, [1, 3]);
Retains only the elements specified by the predicate.
\nIn other words, remove all elements e
for which f(&e)
returns false
.\nThis method operates in place, visiting each element exactly once in the\noriginal order, and preserves the order of the retained elements.
let mut vec = vec![1, 2, 3, 4];\nvec.retain(|&x| x % 2 == 0);\nassert_eq!(vec, [2, 4]);
Because the elements are visited exactly once in the original order,\nexternal state may be used to decide which elements to keep.
\n\nlet mut vec = vec![1, 2, 3, 4, 5];\nlet keep = [false, true, true, false, true];\nlet mut iter = keep.iter();\nvec.retain(|_| *iter.next().unwrap());\nassert_eq!(vec, [2, 3, 5]);
Retains only the elements specified by the predicate, passing a mutable reference to it.
\nIn other words, remove all elements e
such that f(&mut e)
returns false
.\nThis method operates in place, visiting each element exactly once in the\noriginal order, and preserves the order of the retained elements.
let mut vec = vec![1, 2, 3, 4];\nvec.retain_mut(|x| if *x <= 3 {\n *x += 1;\n true\n} else {\n false\n});\nassert_eq!(vec, [2, 3, 4]);
Removes all but the first of consecutive elements in the vector that resolve to the same\nkey.
\nIf the vector is sorted, this removes all duplicates.
\nlet mut vec = vec![10, 20, 21, 30, 20];\n\nvec.dedup_by_key(|i| *i / 10);\n\nassert_eq!(vec, [10, 20, 30, 20]);
Removes all but the first of consecutive elements in the vector satisfying a given equality\nrelation.
\nThe same_bucket
function is passed references to two elements from the vector and\nmust determine if the elements compare equal. The elements are passed in opposite order\nfrom their order in the slice, so if same_bucket(a, b)
returns true
, a
is removed.
If the vector is sorted, this removes all duplicates.
\nlet mut vec = vec![\"foo\", \"bar\", \"Bar\", \"baz\", \"bar\"];\n\nvec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));\n\nassert_eq!(vec, [\"foo\", \"bar\", \"baz\", \"bar\"]);
Appends an element to the back of a collection.
\nPanics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1, 2];\nvec.push(3);\nassert_eq!(vec, [1, 2, 3]);
Takes amortized O(1) time. If the vector’s length would exceed its\ncapacity after the push, O(capacity) time is taken to copy the\nvector’s elements to a larger allocation. This expensive operation is\noffset by the capacity O(1) insertions it allows.
\nvec_push_within_capacity
)Appends an element if there is sufficient spare capacity, otherwise an error is returned\nwith the element.
\nUnlike push
this method will not reallocate when there’s insufficient capacity.\nThe caller should use reserve
or try_reserve
to ensure that there is enough capacity.
A manual, panic-free alternative to FromIterator
:
#![feature(vec_push_within_capacity)]\n\nuse std::collections::TryReserveError;\nfn from_iter_fallible<T>(iter: impl Iterator<Item=T>) -> Result<Vec<T>, TryReserveError> {\n let mut vec = Vec::new();\n for value in iter {\n if let Err(value) = vec.push_within_capacity(value) {\n vec.try_reserve(1)?;\n // this cannot fail, the previous line either returned or added at least 1 free slot\n let _ = vec.push_within_capacity(value);\n }\n }\n Ok(vec)\n}\nassert_eq!(from_iter_fallible(0..100), Ok(Vec::from_iter(0..100)));
Takes O(1) time.
\nRemoves the last element from a vector and returns it, or None
if it\nis empty.
If you’d like to pop the first element, consider using\nVecDeque::pop_front
instead.
let mut vec = vec![1, 2, 3];\nassert_eq!(vec.pop(), Some(3));\nassert_eq!(vec, [1, 2]);
Takes O(1) time.
\nvec_pop_if
)Removes and returns the last element in a vector if the predicate\nreturns true
, or None
if the predicate returns false or the vector\nis empty.
#![feature(vec_pop_if)]\n\nlet mut vec = vec![1, 2, 3, 4];\nlet pred = |x: &mut i32| *x % 2 == 0;\n\nassert_eq!(vec.pop_if(pred), Some(4));\nassert_eq!(vec, [1, 2, 3]);\nassert_eq!(vec.pop_if(pred), None);
Removes the specified range from the vector in bulk, returning all\nremoved elements as an iterator. If the iterator is dropped before\nbeing fully consumed, it drops the remaining removed elements.
\nThe returned iterator keeps a mutable borrow on the vector to optimize\nits implementation.
\nPanics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nIf the returned iterator goes out of scope without being dropped (due to\nmem::forget
, for example), the vector may have lost and leaked\nelements arbitrarily, including elements outside the range.
let mut v = vec![1, 2, 3];\nlet u: Vec<_> = v.drain(1..).collect();\nassert_eq!(v, &[1]);\nassert_eq!(u, &[2, 3]);\n\n// A full range clears the vector, like `clear()` does\nv.drain(..);\nassert_eq!(v, &[]);
Clears the vector, removing all values.
\nNote that this method has no effect on the allocated capacity\nof the vector.
\nlet mut v = vec![1, 2, 3];\n\nv.clear();\n\nassert!(v.is_empty());
Returns the number of elements in the vector, also referred to\nas its ‘length’.
\nlet a = vec![1, 2, 3];\nassert_eq!(a.len(), 3);
Returns true
if the vector contains no elements.
let mut v = Vec::new();\nassert!(v.is_empty());\n\nv.push(1);\nassert!(!v.is_empty());
Splits the collection into two at the given index.
\nReturns a newly allocated vector containing the elements in the range\n[at, len)
. After the call, the original vector will be left containing\nthe elements [0, at)
with its previous capacity unchanged.
mem::take
or mem::replace
.Vec::truncate
.Vec::drain
.Panics if at > len
.
let mut vec = vec![1, 2, 3];\nlet vec2 = vec.split_off(1);\nassert_eq!(vec, [1]);\nassert_eq!(vec2, [2, 3]);
Resizes the Vec
in-place so that len
is equal to new_len
.
If new_len
is greater than len
, the Vec
is extended by the\ndifference, with each additional slot filled with the result of\ncalling the closure f
. The return values from f
will end up\nin the Vec
in the order they have been generated.
If new_len
is less than len
, the Vec
is simply truncated.
This method uses a closure to create new values on every push. If\nyou’d rather Clone
a given value, use Vec::resize
. If you\nwant to use the Default
trait to generate values, you can\npass Default::default
as the second argument.
let mut vec = vec![1, 2, 3];\nvec.resize_with(5, Default::default);\nassert_eq!(vec, [1, 2, 3, 0, 0]);\n\nlet mut vec = vec![];\nlet mut p = 1;\nvec.resize_with(4, || { p *= 2; p });\nassert_eq!(vec, [2, 4, 8, 16]);
Consumes and leaks the Vec
, returning a mutable reference to the contents,\n&'a mut [T]
.
Note that the type T
must outlive the chosen lifetime 'a
. If the type\nhas only static references, or none at all, then this may be chosen to be\n'static
.
As of Rust 1.57, this method does not reallocate or shrink the Vec
,\nso the leaked allocation may include unused capacity that is not part\nof the returned slice.
This function is mainly useful for data that lives for the remainder of\nthe program’s life. Dropping the returned reference will cause a memory\nleak.
\nSimple usage:
\n\nlet x = vec![1, 2, 3];\nlet static_ref: &'static mut [usize] = x.leak();\nstatic_ref[0] += 1;\nassert_eq!(static_ref, &[2, 2, 3]);
Returns the remaining spare capacity of the vector as a slice of\nMaybeUninit<T>
.
The returned slice can be used to fill the vector with data (e.g. by\nreading from a file) before marking the data as initialized using the\nset_len
method.
// Allocate vector big enough for 10 elements.\nlet mut v = Vec::with_capacity(10);\n\n// Fill in the first 3 elements.\nlet uninit = v.spare_capacity_mut();\nuninit[0].write(0);\nuninit[1].write(1);\nuninit[2].write(2);\n\n// Mark the first 3 elements of the vector as being initialized.\nunsafe {\n v.set_len(3);\n}\n\nassert_eq!(&v, &[0, 1, 2]);
vec_split_at_spare
)Returns vector content as a slice of T
, along with the remaining spare\ncapacity of the vector as a slice of MaybeUninit<T>
.
The returned spare capacity slice can be used to fill the vector with data\n(e.g. by reading from a file) before marking the data as initialized using\nthe set_len
method.
Note that this is a low-level API, which should be used with care for\noptimization purposes. If you need to append data to a Vec
\nyou can use push
, extend
, extend_from_slice
,\nextend_from_within
, insert
, append
, resize
or\nresize_with
, depending on your exact needs.
#![feature(vec_split_at_spare)]\n\nlet mut v = vec![1, 1, 2];\n\n// Reserve additional space big enough for 10 elements.\nv.reserve(10);\n\nlet (init, uninit) = v.split_at_spare_mut();\nlet sum = init.iter().copied().sum::<u32>();\n\n// Fill in the next 4 elements.\nuninit[0].write(sum);\nuninit[1].write(sum * 2);\nuninit[2].write(sum * 3);\nuninit[3].write(sum * 4);\n\n// Mark the 4 elements of the vector as being initialized.\nunsafe {\n let len = v.len();\n v.set_len(len + 4);\n}\n\nassert_eq!(&v, &[1, 1, 2, 4, 8, 12, 16]);
self
size_of<T> * capacity
). Read moreupcoming
UTF-16\ncode units. The implementation must not assume upcoming
\nto be exact. The caller may write more or fewer code units\nusing write_slice()
and write_char()
. However, the\ncaller should try to give reasonable estimates if it uses\nthis method. Read moreSelf<'a>
’s lifetime. Read moreself
between &'a mut Self<'static>
and &'a mut Self<'a>
,\nand pass it to f
. Read moreSelf
from the given unstructured data. Read moreSelf
from the entirety of the given\nunstructured data. Read moreOverwrites the contents of self
with a clone of the contents of source
.
This method is preferred over simply assigning source.clone()
to self
,\nas it avoids reallocation if possible. Additionally, if the element type\nT
overrides clone_from()
, this will reuse the resources of self
’s\nelements as well.
let x = vec![5, 6, 7];\nlet mut y = vec![8, 9, 10];\nlet yp: *const i32 = y.as_ptr();\n\ny.clone_from(&x);\n\n// The value is the same\nassert_eq!(x, y);\n\n// And no reallocation occurred\nassert_eq!(yp, y.as_ptr());
cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]cb
with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T
. Read moreVarULE
] typeVarULE
] type to the dst
buffer. dst
should\nbe the size of [Self::encode_var_ule_len()
]Extend implementation that copies elements out of references before pushing them onto the Vec.
\nThis implementation is specialized for slice iterators, where it uses copy_from_slice
to\nappend the entire slice at once.
extend_one
)extend_one
)extend_one
)extend_one
)Converts a BinaryHeap<T>
into a Vec<T>
.
This conversion requires no data movement or allocation, and has\nconstant time complexity.
\nConverts a clone-on-write slice into a vector.
\nIf s
already owns a Vec<T>
, it will be returned directly.\nIf s
is borrowing a slice, a new Vec<T>
will be allocated and\nfilled by cloning s
’s items into it.
let o: Cow<'_, [i32]> = Cow::Owned(vec![1, 2, 3]);\nlet b: Cow<'_, [i32]> = Cow::Borrowed(&[1, 2, 3]);\nassert_eq!(Vec::from(o), Vec::from(b));
Turn a VecDeque<T>
into a Vec<T>
.
This never needs to re-allocate, but does need to do O(n) data movement if\nthe circular buffer doesn’t happen to be at the beginning of the allocation.
\nuse std::collections::VecDeque;\n\n// This one is *O*(1).\nlet deque: VecDeque<_> = (1..5).collect();\nlet ptr = deque.as_slices().0.as_ptr();\nlet vec = Vec::from(deque);\nassert_eq!(vec, [1, 2, 3, 4]);\nassert_eq!(vec.as_ptr(), ptr);\n\n// This one needs data rearranging.\nlet mut deque: VecDeque<_> = (1..5).collect();\ndeque.push_front(9);\ndeque.push_front(8);\nlet ptr = deque.as_slices().1.as_ptr();\nlet vec = Vec::from(deque);\nassert_eq!(vec, [8, 9, 1, 2, 3, 4]);\nassert_eq!(vec.as_ptr(), ptr);
Collects an iterator into a Vec, commonly called via Iterator::collect()
In general Vec
does not guarantee any particular growth or allocation strategy.\nThat also applies to this trait impl.
Note: This section covers implementation details and is therefore exempt from\nstability guarantees.
\nVec may use any or none of the following strategies,\ndepending on the supplied iterator:
\nIterator::size_hint()
\npushing
one item at a timeThe last case warrants some attention. It is an optimization that in many cases reduces peak memory\nconsumption and improves cache locality. But when big, short-lived allocations are created,\nonly a small fraction of their items get collected, no further use is made of the spare capacity\nand the resulting Vec
is moved into a longer-lived structure, then this can lead to the large\nallocations having their lifetimes unnecessarily extended which can result in increased memory\nfootprint.
In cases where this is an issue, the excess capacity can be discarded with Vec::shrink_to()
,\nVec::shrink_to_fit()
or by collecting into Box<[T]>
instead, which additionally reduces\nthe size of the long-lived struct.
static LONG_LIVED: Mutex<Vec<Vec<u16>>> = Mutex::new(Vec::new());\n\nfor i in 0..10 {\n let big_temporary: Vec<u16> = (0..1024).collect();\n // discard most items\n let mut result: Vec<_> = big_temporary.into_iter().filter(|i| i % 100 == 0).collect();\n // without this a lot of unused capacity might be moved into the global\n result.shrink_to_fit();\n LONG_LIVED.lock().unwrap().push(result);\n}
The hash of a vector is the same as that of the corresponding slice,\nas required by the core::borrow::Borrow
implementation.
use std::hash::BuildHasher;\n\nlet b = std::hash::RandomState::new();\nlet v: Vec<u8> = vec![0xa8, 0x3c, 0x09];\nlet s: &[u8] = &[0xa8, 0x3c, 0x09];\nassert_eq!(b.hash_one(v), b.hash_one(s));
Creates a consuming iterator, that is, one that moves each value out of\nthe vector (from start to end). The vector cannot be used after calling\nthis.
\nlet v = vec![\"a\".to_string(), \"b\".to_string()];\nlet mut v_iter = v.into_iter();\n\nlet first_element: Option<String> = v_iter.next();\n\nassert_eq!(first_element, Some(\"a\".to_string()));\nassert_eq!(v_iter.next(), Some(\"b\".to_string()));\nassert_eq!(v_iter.next(), None);
MaybeOwnedMut
].IoSliceMut
]s of the buffers. Read moreImplements ordering of vectors, lexicographically.
\nImplements comparison of vectors, lexicographically.
\nlen
is less than the current length, nothing\nshould happen. Read moreSink
to receive a value. Read morepoll_ready
which returned Poll::Ready(Ok(()))
. Read moreConstructs a new, empty Vec<T>
.
The vector will not allocate until elements are pushed onto it.
\nlet mut vec: Vec<i32> = Vec::new();
Constructs a new, empty Vec<T>
with at least the specified capacity.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
It is important to note that although the returned vector has the\nminimum capacity specified, the vector will have a zero length. For\nan explanation of the difference between length and capacity, see\nCapacity and reallocation.
\nIf it is important to know the exact allocated capacity of a Vec
,\nalways use the capacity
method after construction.
For Vec<T>
where T
is a zero-sized type, there will be no allocation\nand the capacity will always be usize::MAX
.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = Vec::with_capacity(10);\n\n// The vector contains no items, even though it has capacity for more\nassert_eq!(vec.len(), 0);\nassert!(vec.capacity() >= 10);\n\n// These are all done without reallocating...\nfor i in 0..10 {\n vec.push(i);\n}\nassert_eq!(vec.len(), 10);\nassert!(vec.capacity() >= 10);\n\n// ...but this may make the vector reallocate\nvec.push(11);\nassert_eq!(vec.len(), 11);\nassert!(vec.capacity() >= 11);\n\n// A vector of a zero-sized type will always over-allocate, since no\n// allocation is necessary\nlet vec_units = Vec::<()>::with_capacity(10);\nassert_eq!(vec_units.capacity(), usize::MAX);
try_with_capacity
)Constructs a new, empty Vec<T>
with at least the specified capacity.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
Returns an error if the capacity exceeds isize::MAX
bytes,\nor if the allocator reports allocation failure.
Creates a Vec<T>
directly from a pointer, a length, and a capacity.
This is highly unsafe, due to the number of invariants that aren’t\nchecked:
\nptr
must have been allocated using the global allocator, such as via\nthe alloc::alloc
function.T
needs to have the same alignment as what ptr
was allocated with.\n(T
having a less strict alignment is not sufficient, the alignment really\nneeds to be equal to satisfy the dealloc
requirement that memory must be\nallocated and deallocated with the same layout.)T
times the capacity
(ie. the allocated size in bytes) needs\nto be the same size as the pointer was allocated with. (Because similar to\nalignment, dealloc
must be called with the same layout size
.)length
needs to be less than or equal to capacity
.length
values must be properly initialized values of type T
.capacity
needs to be the capacity that the pointer was allocated with.isize::MAX
.\nSee the safety documentation of pointer::offset
.These requirements are always upheld by any ptr
that has been allocated\nvia Vec<T>
. Other allocation sources are allowed if the invariants are\nupheld.
Violating these may cause problems like corrupting the allocator’s\ninternal data structures. For example it is normally not safe\nto build a Vec<u8>
from a pointer to a C char
array with length\nsize_t
, doing so is only safe if the array was initially allocated by\na Vec
or String
.\nIt’s also not safe to build one from a Vec<u16>
and its length, because\nthe allocator cares about the alignment, and these two types have different\nalignments. The buffer was allocated with alignment 2 (for u16
), but after\nturning it into a Vec<u8>
it’ll be deallocated with alignment 1. To avoid\nthese issues, it is often preferable to do casting/transmuting using\nslice::from_raw_parts
instead.
The ownership of ptr
is effectively transferred to the\nVec<T>
which may then deallocate, reallocate or change the\ncontents of memory pointed to by the pointer at will. Ensure\nthat nothing else uses the pointer after calling this\nfunction.
use std::ptr;\nuse std::mem;\n\nlet v = vec![1, 2, 3];\n\n// Prevent running `v`'s destructor so we are in complete control\n// of the allocation.\nlet mut v = mem::ManuallyDrop::new(v);\n\n// Pull out the various important pieces of information about `v`\nlet p = v.as_mut_ptr();\nlet len = v.len();\nlet cap = v.capacity();\n\nunsafe {\n // Overwrite memory with 4, 5, 6\n for i in 0..len {\n ptr::write(p.add(i), 4 + i);\n }\n\n // Put everything back together into a Vec\n let rebuilt = Vec::from_raw_parts(p, len, cap);\n assert_eq!(rebuilt, [4, 5, 6]);\n}
Using memory that was allocated elsewhere:
\n\nuse std::alloc::{alloc, Layout};\n\nfn main() {\n let layout = Layout::array::<u32>(16).expect(\"overflow cannot happen\");\n\n let vec = unsafe {\n let mem = alloc(layout).cast::<u32>();\n if mem.is_null() {\n return;\n }\n\n mem.write(1_000_000);\n\n Vec::from_raw_parts(mem, 1, 16)\n };\n\n assert_eq!(vec, &[1_000_000]);\n assert_eq!(vec.capacity(), 16);\n}
Resizes the Vec
in-place so that len
is equal to new_len
.
If new_len
is greater than len
, the Vec
is extended by the\ndifference, with each additional slot filled with value
.\nIf new_len
is less than len
, the Vec
is simply truncated.
This method requires T
to implement Clone
,\nin order to be able to clone the passed value.\nIf you need more flexibility (or want to rely on Default
instead of\nClone
), use Vec::resize_with
.\nIf you only need to resize to a smaller size, use Vec::truncate
.
let mut vec = vec![\"hello\"];\nvec.resize(3, \"world\");\nassert_eq!(vec, [\"hello\", \"world\", \"world\"]);\n\nlet mut vec = vec![1, 2, 3, 4];\nvec.resize(2, 0);\nassert_eq!(vec, [1, 2]);
Clones and appends all elements in a slice to the Vec
.
Iterates over the slice other
, clones each element, and then appends\nit to this Vec
. The other
slice is traversed in-order.
Note that this function is same as extend
except that it is\nspecialized to work with slices instead. If and when Rust gets\nspecialization this function will likely be deprecated (but still\navailable).
let mut vec = vec![1];\nvec.extend_from_slice(&[2, 3, 4]);\nassert_eq!(vec, [1, 2, 3, 4]);
Copies elements from src
range to the end of the vector.
Panics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nlet mut vec = vec![0, 1, 2, 3, 4];\n\nvec.extend_from_within(2..);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4]);\n\nvec.extend_from_within(..2);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1]);\n\nvec.extend_from_within(4..8);\nassert_eq!(vec, [0, 1, 2, 3, 4, 2, 3, 4, 0, 1, 4, 2, 3, 4]);
Creates a splicing iterator that replaces the specified range in the vector\nwith the given replace_with
iterator and yields the removed items.\nreplace_with
does not need to be the same length as range
.
range
is removed even if the iterator is not consumed until the end.
It is unspecified how many elements are removed from the vector\nif the Splice
value is leaked.
The input iterator replace_with
is only consumed when the Splice
value is dropped.
This is optimal if:
\nrange
) is empty,replace_with
yields fewer or equal elements than range
’s lengthsize_hint()
is exact.Otherwise, a temporary vector is allocated and the tail is moved twice.
\nPanics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nlet mut v = vec![1, 2, 3, 4];\nlet new = [7, 8, 9];\nlet u: Vec<_> = v.splice(1..3, new).collect();\nassert_eq!(v, &[1, 7, 8, 9, 4]);\nassert_eq!(u, &[2, 3]);
extract_if
)Creates an iterator which uses a closure to determine if an element should be removed.
\nIf the closure returns true, then the element is removed and yielded.\nIf the closure returns false, the element will remain in the vector and will not be yielded\nby the iterator.
\nIf the returned ExtractIf
is not exhausted, e.g. because it is dropped without iterating\nor the iteration short-circuits, then the remaining elements will be retained.\nUse retain
with a negated predicate if you do not need the returned iterator.
Using this method is equivalent to the following code:
\n\nlet mut i = 0;\nwhile i < vec.len() {\n if some_predicate(&mut vec[i]) {\n let val = vec.remove(i);\n // your code here\n } else {\n i += 1;\n }\n}\n
But extract_if
is easier to use. extract_if
is also more efficient,\nbecause it can backshift the elements of the array in bulk.
Note that extract_if
also lets you mutate every element in the filter closure,\nregardless of whether you choose to keep or remove it.
Splitting an array into evens and odds, reusing the original allocation:
\n\n#![feature(extract_if)]\nlet mut numbers = vec![1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15];\n\nlet evens = numbers.extract_if(|x| *x % 2 == 0).collect::<Vec<_>>();\nlet odds = numbers;\n\nassert_eq!(evens, vec![2, 4, 6, 8, 14]);\nassert_eq!(odds, vec![1, 3, 5, 9, 11, 13, 15]);
allocator_api
)Constructs a new, empty Vec<T, A>
.
The vector will not allocate until elements are pushed onto it.
\n#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut vec: Vec<i32, _> = Vec::new_in(System);
allocator_api
)Constructs a new, empty Vec<T, A>
with at least the specified capacity\nwith the provided allocator.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
It is important to note that although the returned vector has the\nminimum capacity specified, the vector will have a zero length. For\nan explanation of the difference between length and capacity, see\nCapacity and reallocation.
\nIf it is important to know the exact allocated capacity of a Vec
,\nalways use the capacity
method after construction.
For Vec<T, A>
where T
is a zero-sized type, there will be no allocation\nand the capacity will always be usize::MAX
.
Panics if the new capacity exceeds isize::MAX
bytes.
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut vec = Vec::with_capacity_in(10, System);\n\n// The vector contains no items, even though it has capacity for more\nassert_eq!(vec.len(), 0);\nassert!(vec.capacity() >= 10);\n\n// These are all done without reallocating...\nfor i in 0..10 {\n vec.push(i);\n}\nassert_eq!(vec.len(), 10);\nassert!(vec.capacity() >= 10);\n\n// ...but this may make the vector reallocate\nvec.push(11);\nassert_eq!(vec.len(), 11);\nassert!(vec.capacity() >= 11);\n\n// A vector of a zero-sized type will always over-allocate, since no\n// allocation is necessary\nlet vec_units = Vec::<(), System>::with_capacity_in(10, System);\nassert_eq!(vec_units.capacity(), usize::MAX);
allocator_api
)Constructs a new, empty Vec<T, A>
with at least the specified capacity\nwith the provided allocator.
The vector will be able to hold at least capacity
elements without\nreallocating. This method is allowed to allocate for more elements than\ncapacity
. If capacity
is 0, the vector will not allocate.
Returns an error if the capacity exceeds isize::MAX
bytes,\nor if the allocator reports allocation failure.
allocator_api
)Creates a Vec<T, A>
directly from a pointer, a length, a capacity,\nand an allocator.
This is highly unsafe, due to the number of invariants that aren’t\nchecked:
\nptr
must be currently allocated via the given allocator alloc
.T
needs to have the same alignment as what ptr
was allocated with.\n(T
having a less strict alignment is not sufficient, the alignment really\nneeds to be equal to satisfy the dealloc
requirement that memory must be\nallocated and deallocated with the same layout.)T
times the capacity
(ie. the allocated size in bytes) needs\nto be the same size as the pointer was allocated with. (Because similar to\nalignment, dealloc
must be called with the same layout size
.)length
needs to be less than or equal to capacity
.length
values must be properly initialized values of type T
.capacity
needs to fit the layout size that the pointer was allocated with.isize::MAX
.\nSee the safety documentation of pointer::offset
.These requirements are always upheld by any ptr
that has been allocated\nvia Vec<T, A>
. Other allocation sources are allowed if the invariants are\nupheld.
Violating these may cause problems like corrupting the allocator’s\ninternal data structures. For example it is not safe\nto build a Vec<u8>
from a pointer to a C char
array with length size_t
.\nIt’s also not safe to build one from a Vec<u16>
and its length, because\nthe allocator cares about the alignment, and these two types have different\nalignments. The buffer was allocated with alignment 2 (for u16
), but after\nturning it into a Vec<u8>
it’ll be deallocated with alignment 1.
The ownership of ptr
is effectively transferred to the\nVec<T>
which may then deallocate, reallocate or change the\ncontents of memory pointed to by the pointer at will. Ensure\nthat nothing else uses the pointer after calling this\nfunction.
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nuse std::ptr;\nuse std::mem;\n\nlet mut v = Vec::with_capacity_in(3, System);\nv.push(1);\nv.push(2);\nv.push(3);\n\n// Prevent running `v`'s destructor so we are in complete control\n// of the allocation.\nlet mut v = mem::ManuallyDrop::new(v);\n\n// Pull out the various important pieces of information about `v`\nlet p = v.as_mut_ptr();\nlet len = v.len();\nlet cap = v.capacity();\nlet alloc = v.allocator();\n\nunsafe {\n // Overwrite memory with 4, 5, 6\n for i in 0..len {\n ptr::write(p.add(i), 4 + i);\n }\n\n // Put everything back together into a Vec\n let rebuilt = Vec::from_raw_parts_in(p, len, cap, alloc.clone());\n assert_eq!(rebuilt, [4, 5, 6]);\n}
Using memory that was allocated elsewhere:
\n\n#![feature(allocator_api)]\n\nuse std::alloc::{AllocError, Allocator, Global, Layout};\n\nfn main() {\n let layout = Layout::array::<u32>(16).expect(\"overflow cannot happen\");\n\n let vec = unsafe {\n let mem = match Global.allocate(layout) {\n Ok(mem) => mem.cast::<u32>().as_ptr(),\n Err(AllocError) => return,\n };\n\n mem.write(1_000_000);\n\n Vec::from_raw_parts_in(mem, 1, 16, Global)\n };\n\n assert_eq!(vec, &[1_000_000]);\n assert_eq!(vec.capacity(), 16);\n}
vec_into_raw_parts
)Decomposes a Vec<T>
into its raw components: (pointer, length, capacity)
.
Returns the raw pointer to the underlying data, the length of\nthe vector (in elements), and the allocated capacity of the\ndata (in elements). These are the same arguments in the same\norder as the arguments to from_raw_parts
.
After calling this function, the caller is responsible for the\nmemory previously managed by the Vec
. The only way to do\nthis is to convert the raw pointer, length, and capacity back\ninto a Vec
with the from_raw_parts
function, allowing\nthe destructor to perform the cleanup.
#![feature(vec_into_raw_parts)]\nlet v: Vec<i32> = vec![-1, 0, 1];\n\nlet (ptr, len, cap) = v.into_raw_parts();\n\nlet rebuilt = unsafe {\n // We can now make changes to the components, such as\n // transmuting the raw pointer to a compatible type.\n let ptr = ptr as *mut u32;\n\n Vec::from_raw_parts(ptr, len, cap)\n};\nassert_eq!(rebuilt, [4294967295, 0, 1]);
allocator_api
)Decomposes a Vec<T>
into its raw components: (pointer, length, capacity, allocator)
.
Returns the raw pointer to the underlying data, the length of the vector (in elements),\nthe allocated capacity of the data (in elements), and the allocator. These are the same\narguments in the same order as the arguments to from_raw_parts_in
.
After calling this function, the caller is responsible for the\nmemory previously managed by the Vec
. The only way to do\nthis is to convert the raw pointer, length, and capacity back\ninto a Vec
with the from_raw_parts_in
function, allowing\nthe destructor to perform the cleanup.
#![feature(allocator_api, vec_into_raw_parts)]\n\nuse std::alloc::System;\n\nlet mut v: Vec<i32, System> = Vec::new_in(System);\nv.push(-1);\nv.push(0);\nv.push(1);\n\nlet (ptr, len, cap, alloc) = v.into_raw_parts_with_alloc();\n\nlet rebuilt = unsafe {\n // We can now make changes to the components, such as\n // transmuting the raw pointer to a compatible type.\n let ptr = ptr as *mut u32;\n\n Vec::from_raw_parts_in(ptr, len, cap, alloc)\n};\nassert_eq!(rebuilt, [4294967295, 0, 1]);
Returns the total number of elements the vector can hold without\nreallocating.
\nlet mut vec: Vec<i32> = Vec::with_capacity(10);\nvec.push(42);\nassert!(vec.capacity() >= 10);
Reserves capacity for at least additional
more elements to be inserted\nin the given Vec<T>
. The collection may reserve more space to\nspeculatively avoid frequent reallocations. After calling reserve
,\ncapacity will be greater than or equal to self.len() + additional
.\nDoes nothing if capacity is already sufficient.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1];\nvec.reserve(10);\nassert!(vec.capacity() >= 11);
Reserves the minimum capacity for at least additional
more elements to\nbe inserted in the given Vec<T>
. Unlike reserve
, this will not\ndeliberately over-allocate to speculatively avoid frequent allocations.\nAfter calling reserve_exact
, capacity will be greater than or equal to\nself.len() + additional
. Does nothing if the capacity is already\nsufficient.
Note that the allocator may give the collection more space than it\nrequests. Therefore, capacity can not be relied upon to be precisely\nminimal. Prefer reserve
if future insertions are expected.
Panics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1];\nvec.reserve_exact(10);\nassert!(vec.capacity() >= 11);
Tries to reserve capacity for at least additional
more elements to be inserted\nin the given Vec<T>
. The collection may reserve more space to speculatively avoid\nfrequent reallocations. After calling try_reserve
, capacity will be\ngreater than or equal to self.len() + additional
if it returns\nOk(())
. Does nothing if capacity is already sufficient. This method\npreserves the contents even if an error occurs.
If the capacity overflows, or the allocator reports a failure, then an error\nis returned.
\nuse std::collections::TryReserveError;\n\nfn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {\n let mut output = Vec::new();\n\n // Pre-reserve the memory, exiting if we can't\n output.try_reserve(data.len())?;\n\n // Now we know this can't OOM in the middle of our complex work\n output.extend(data.iter().map(|&val| {\n val * 2 + 5 // very complicated\n }));\n\n Ok(output)\n}
Tries to reserve the minimum capacity for at least additional
\nelements to be inserted in the given Vec<T>
. Unlike try_reserve
,\nthis will not deliberately over-allocate to speculatively avoid frequent\nallocations. After calling try_reserve_exact
, capacity will be greater\nthan or equal to self.len() + additional
if it returns Ok(())
.\nDoes nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it\nrequests. Therefore, capacity can not be relied upon to be precisely\nminimal. Prefer try_reserve
if future insertions are expected.
If the capacity overflows, or the allocator reports a failure, then an error\nis returned.
\nuse std::collections::TryReserveError;\n\nfn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {\n let mut output = Vec::new();\n\n // Pre-reserve the memory, exiting if we can't\n output.try_reserve_exact(data.len())?;\n\n // Now we know this can't OOM in the middle of our complex work\n output.extend(data.iter().map(|&val| {\n val * 2 + 5 // very complicated\n }));\n\n Ok(output)\n}
Shrinks the capacity of the vector as much as possible.
\nThe behavior of this method depends on the allocator, which may either shrink the vector\nin-place or reallocate. The resulting vector might still have some excess capacity, just as\nis the case for with_capacity
. See Allocator::shrink
for more details.
let mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\nassert!(vec.capacity() >= 10);\nvec.shrink_to_fit();\nassert!(vec.capacity() >= 3);
Shrinks the capacity of the vector with a lower bound.
\nThe capacity will remain at least as large as both the length\nand the supplied value.
\nIf the current capacity is less than the lower limit, this is a no-op.
\nlet mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\nassert!(vec.capacity() >= 10);\nvec.shrink_to(4);\nassert!(vec.capacity() >= 4);\nvec.shrink_to(0);\nassert!(vec.capacity() >= 3);
Converts the vector into Box<[T]>
.
Before doing the conversion, this method discards excess capacity like shrink_to_fit
.
let v = vec![1, 2, 3];\n\nlet slice = v.into_boxed_slice();
Any excess capacity is removed:
\n\nlet mut vec = Vec::with_capacity(10);\nvec.extend([1, 2, 3]);\n\nassert!(vec.capacity() >= 10);\nlet slice = vec.into_boxed_slice();\nassert_eq!(slice.into_vec().capacity(), 3);
Shortens the vector, keeping the first len
elements and dropping\nthe rest.
If len
is greater or equal to the vector’s current length, this has\nno effect.
The drain
method can emulate truncate
, but causes the excess\nelements to be returned instead of dropped.
Note that this method has no effect on the allocated capacity\nof the vector.
\nTruncating a five element vector to two elements:
\n\nlet mut vec = vec![1, 2, 3, 4, 5];\nvec.truncate(2);\nassert_eq!(vec, [1, 2]);
No truncation occurs when len
is greater than the vector’s current\nlength:
let mut vec = vec![1, 2, 3];\nvec.truncate(8);\nassert_eq!(vec, [1, 2, 3]);
Truncating when len == 0
is equivalent to calling the clear
\nmethod.
let mut vec = vec![1, 2, 3];\nvec.truncate(0);\nassert_eq!(vec, []);
Extracts a slice containing the entire vector.
\nEquivalent to &s[..]
.
use std::io::{self, Write};\nlet buffer = vec![1, 2, 3, 5, 8];\nio::sink().write(buffer.as_slice()).unwrap();
Extracts a mutable slice of the entire vector.
\nEquivalent to &mut s[..]
.
use std::io::{self, Read};\nlet mut buffer = vec![0; 3];\nio::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();
Returns a raw pointer to the vector’s buffer, or a dangling raw pointer\nvalid for zero sized reads if the vector didn’t allocate.
\nThe caller must ensure that the vector outlives the pointer this\nfunction returns, or else it will end up dangling.\nModifying the vector may cause its buffer to be reallocated,\nwhich would also make any pointers to it invalid.
\nThe caller must also ensure that the memory the pointer (non-transitively) points to\nis never written to (except inside an UnsafeCell
) using this pointer or any pointer\nderived from it. If you need to mutate the contents of the slice, use as_mut_ptr
.
This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying slice, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr
and as_mut_ptr
.\nNote that calling other methods that materialize mutable references to the slice,\nor mutable references to specific elements you are planning on accessing through this pointer,\nas well as writing to those elements, may still invalidate this pointer.\nSee the second example below for how this guarantee can be used.
let x = vec![1, 2, 4];\nlet x_ptr = x.as_ptr();\n\nunsafe {\n for i in 0..x.len() {\n assert_eq!(*x_ptr.add(i), 1 << i);\n }\n}
Due to the aliasing guarantee, the following code is legal:
\n\nunsafe {\n let mut v = vec![0, 1, 2];\n let ptr1 = v.as_ptr();\n let _ = ptr1.read();\n let ptr2 = v.as_mut_ptr().offset(2);\n ptr2.write(2);\n // Notably, the write to `ptr2` did *not* invalidate `ptr1`\n // because it mutated a different element:\n let _ = ptr1.read();\n}
Returns a raw mutable pointer to the vector’s buffer, or a dangling\nraw pointer valid for zero sized reads if the vector didn’t allocate.
\nThe caller must ensure that the vector outlives the pointer this\nfunction returns, or else it will end up dangling.\nModifying the vector may cause its buffer to be reallocated,\nwhich would also make any pointers to it invalid.
\nThis method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying slice, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr
and as_mut_ptr
.\nNote that calling other methods that materialize references to the slice,\nor references to specific elements you are planning on accessing through this pointer,\nmay still invalidate this pointer.\nSee the second example below for how this guarantee can be used.
// Allocate vector big enough for 4 elements.\nlet size = 4;\nlet mut x: Vec<i32> = Vec::with_capacity(size);\nlet x_ptr = x.as_mut_ptr();\n\n// Initialize elements via raw pointer writes, then set length.\nunsafe {\n for i in 0..size {\n *x_ptr.add(i) = i as i32;\n }\n x.set_len(size);\n}\nassert_eq!(&*x, &[0, 1, 2, 3]);
Due to the aliasing guarantee, the following code is legal:
\n\nunsafe {\n let mut v = vec![0];\n let ptr1 = v.as_mut_ptr();\n ptr1.write(1);\n let ptr2 = v.as_mut_ptr();\n ptr2.write(2);\n // Notably, the write to `ptr2` did *not* invalidate `ptr1`:\n ptr1.write(3);\n}
allocator_api
)Returns a reference to the underlying allocator.
\nForces the length of the vector to new_len
.
This is a low-level operation that maintains none of the normal\ninvariants of the type. Normally changing the length of a vector\nis done using one of the safe operations instead, such as\ntruncate
, resize
, extend
, or clear
.
new_len
must be less than or equal to capacity()
.old_len..new_len
must be initialized.This method can be useful for situations in which the vector\nis serving as a buffer for other code, particularly over FFI:
\n\npub fn get_dictionary(&self) -> Option<Vec<u8>> {\n // Per the FFI method's docs, \"32768 bytes is always enough\".\n let mut dict = Vec::with_capacity(32_768);\n let mut dict_length = 0;\n // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that:\n // 1. `dict_length` elements were initialized.\n // 2. `dict_length` <= the capacity (32_768)\n // which makes `set_len` safe to call.\n unsafe {\n // Make the FFI call...\n let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length);\n if r == Z_OK {\n // ...and update the length to what was initialized.\n dict.set_len(dict_length);\n Some(dict)\n } else {\n None\n }\n }\n}
While the following example is sound, there is a memory leak since\nthe inner vectors were not freed prior to the set_len
call:
let mut vec = vec![vec![1, 0, 0],\n vec![0, 1, 0],\n vec![0, 0, 1]];\n// SAFETY:\n// 1. `old_len..0` is empty so no elements need to be initialized.\n// 2. `0 <= capacity` always holds whatever `capacity` is.\nunsafe {\n vec.set_len(0);\n}
Normally, here, one would use clear
instead to correctly drop\nthe contents and thus not leak memory.
Removes an element from the vector and returns it.
\nThe removed element is replaced by the last element of the vector.
\nThis does not preserve ordering of the remaining elements, but is O(1).\nIf you need to preserve the element order, use remove
instead.
Panics if index
is out of bounds.
let mut v = vec![\"foo\", \"bar\", \"baz\", \"qux\"];\n\nassert_eq!(v.swap_remove(1), \"bar\");\nassert_eq!(v, [\"foo\", \"qux\", \"baz\"]);\n\nassert_eq!(v.swap_remove(0), \"foo\");\nassert_eq!(v, [\"baz\", \"qux\"]);
Inserts an element at position index
within the vector, shifting all\nelements after it to the right.
Panics if index > len
.
let mut vec = vec![1, 2, 3];\nvec.insert(1, 4);\nassert_eq!(vec, [1, 4, 2, 3]);\nvec.insert(4, 5);\nassert_eq!(vec, [1, 4, 2, 3, 5]);
Takes O(Vec::len
) time. All items after the insertion index must be\nshifted to the right. In the worst case, all elements are shifted when\nthe insertion index is 0.
Removes and returns the element at position index
within the vector,\nshifting all elements after it to the left.
Note: Because this shifts over the remaining elements, it has a\nworst-case performance of O(n). If you don’t need the order of elements\nto be preserved, use swap_remove
instead. If you’d like to remove\nelements from the beginning of the Vec
, consider using\nVecDeque::pop_front
instead.
Panics if index
is out of bounds.
let mut v = vec![1, 2, 3];\nassert_eq!(v.remove(1), 2);\nassert_eq!(v, [1, 3]);
Retains only the elements specified by the predicate.
\nIn other words, remove all elements e
for which f(&e)
returns false
.\nThis method operates in place, visiting each element exactly once in the\noriginal order, and preserves the order of the retained elements.
let mut vec = vec![1, 2, 3, 4];\nvec.retain(|&x| x % 2 == 0);\nassert_eq!(vec, [2, 4]);
Because the elements are visited exactly once in the original order,\nexternal state may be used to decide which elements to keep.
\n\nlet mut vec = vec![1, 2, 3, 4, 5];\nlet keep = [false, true, true, false, true];\nlet mut iter = keep.iter();\nvec.retain(|_| *iter.next().unwrap());\nassert_eq!(vec, [2, 3, 5]);
Retains only the elements specified by the predicate, passing a mutable reference to it.
\nIn other words, remove all elements e
such that f(&mut e)
returns false
.\nThis method operates in place, visiting each element exactly once in the\noriginal order, and preserves the order of the retained elements.
let mut vec = vec![1, 2, 3, 4];\nvec.retain_mut(|x| if *x <= 3 {\n *x += 1;\n true\n} else {\n false\n});\nassert_eq!(vec, [2, 3, 4]);
Removes all but the first of consecutive elements in the vector that resolve to the same\nkey.
\nIf the vector is sorted, this removes all duplicates.
\nlet mut vec = vec![10, 20, 21, 30, 20];\n\nvec.dedup_by_key(|i| *i / 10);\n\nassert_eq!(vec, [10, 20, 30, 20]);
Removes all but the first of consecutive elements in the vector satisfying a given equality\nrelation.
\nThe same_bucket
function is passed references to two elements from the vector and\nmust determine if the elements compare equal. The elements are passed in opposite order\nfrom their order in the slice, so if same_bucket(a, b)
returns true
, a
is removed.
If the vector is sorted, this removes all duplicates.
\nlet mut vec = vec![\"foo\", \"bar\", \"Bar\", \"baz\", \"bar\"];\n\nvec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));\n\nassert_eq!(vec, [\"foo\", \"bar\", \"baz\", \"bar\"]);
Appends an element to the back of a collection.
\nPanics if the new capacity exceeds isize::MAX
bytes.
let mut vec = vec![1, 2];\nvec.push(3);\nassert_eq!(vec, [1, 2, 3]);
Takes amortized O(1) time. If the vector’s length would exceed its\ncapacity after the push, O(capacity) time is taken to copy the\nvector’s elements to a larger allocation. This expensive operation is\noffset by the capacity O(1) insertions it allows.
\nvec_push_within_capacity
)Appends an element if there is sufficient spare capacity, otherwise an error is returned\nwith the element.
\nUnlike push
this method will not reallocate when there’s insufficient capacity.\nThe caller should use reserve
or try_reserve
to ensure that there is enough capacity.
A manual, panic-free alternative to FromIterator
:
#![feature(vec_push_within_capacity)]\n\nuse std::collections::TryReserveError;\nfn from_iter_fallible<T>(iter: impl Iterator<Item=T>) -> Result<Vec<T>, TryReserveError> {\n let mut vec = Vec::new();\n for value in iter {\n if let Err(value) = vec.push_within_capacity(value) {\n vec.try_reserve(1)?;\n // this cannot fail, the previous line either returned or added at least 1 free slot\n let _ = vec.push_within_capacity(value);\n }\n }\n Ok(vec)\n}\nassert_eq!(from_iter_fallible(0..100), Ok(Vec::from_iter(0..100)));
Takes O(1) time.
\nRemoves the last element from a vector and returns it, or None
if it\nis empty.
If you’d like to pop the first element, consider using\nVecDeque::pop_front
instead.
let mut vec = vec![1, 2, 3];\nassert_eq!(vec.pop(), Some(3));\nassert_eq!(vec, [1, 2]);
Takes O(1) time.
\nvec_pop_if
)Removes and returns the last element in a vector if the predicate\nreturns true
, or None
if the predicate returns false or the vector\nis empty.
#![feature(vec_pop_if)]\n\nlet mut vec = vec![1, 2, 3, 4];\nlet pred = |x: &mut i32| *x % 2 == 0;\n\nassert_eq!(vec.pop_if(pred), Some(4));\nassert_eq!(vec, [1, 2, 3]);\nassert_eq!(vec.pop_if(pred), None);
Removes the specified range from the vector in bulk, returning all\nremoved elements as an iterator. If the iterator is dropped before\nbeing fully consumed, it drops the remaining removed elements.
\nThe returned iterator keeps a mutable borrow on the vector to optimize\nits implementation.
\nPanics if the starting point is greater than the end point or if\nthe end point is greater than the length of the vector.
\nIf the returned iterator goes out of scope without being dropped (due to\nmem::forget
, for example), the vector may have lost and leaked\nelements arbitrarily, including elements outside the range.
let mut v = vec![1, 2, 3];\nlet u: Vec<_> = v.drain(1..).collect();\nassert_eq!(v, &[1]);\nassert_eq!(u, &[2, 3]);\n\n// A full range clears the vector, like `clear()` does\nv.drain(..);\nassert_eq!(v, &[]);
Clears the vector, removing all values.
\nNote that this method has no effect on the allocated capacity\nof the vector.
\nlet mut v = vec![1, 2, 3];\n\nv.clear();\n\nassert!(v.is_empty());
Returns the number of elements in the vector, also referred to\nas its ‘length’.
\nlet a = vec![1, 2, 3];\nassert_eq!(a.len(), 3);
Returns true
if the vector contains no elements.
let mut v = Vec::new();\nassert!(v.is_empty());\n\nv.push(1);\nassert!(!v.is_empty());
Splits the collection into two at the given index.
\nReturns a newly allocated vector containing the elements in the range\n[at, len)
. After the call, the original vector will be left containing\nthe elements [0, at)
with its previous capacity unchanged.
mem::take
or mem::replace
.Vec::truncate
.Vec::drain
.Panics if at > len
.
let mut vec = vec![1, 2, 3];\nlet vec2 = vec.split_off(1);\nassert_eq!(vec, [1]);\nassert_eq!(vec2, [2, 3]);
Resizes the Vec
in-place so that len
is equal to new_len
.
If new_len
is greater than len
, the Vec
is extended by the\ndifference, with each additional slot filled with the result of\ncalling the closure f
. The return values from f
will end up\nin the Vec
in the order they have been generated.
If new_len
is less than len
, the Vec
is simply truncated.
This method uses a closure to create new values on every push. If\nyou’d rather Clone
a given value, use Vec::resize
. If you\nwant to use the Default
trait to generate values, you can\npass Default::default
as the second argument.
let mut vec = vec![1, 2, 3];\nvec.resize_with(5, Default::default);\nassert_eq!(vec, [1, 2, 3, 0, 0]);\n\nlet mut vec = vec![];\nlet mut p = 1;\nvec.resize_with(4, || { p *= 2; p });\nassert_eq!(vec, [2, 4, 8, 16]);
Consumes and leaks the Vec
, returning a mutable reference to the contents,\n&'a mut [T]
.
Note that the type T
must outlive the chosen lifetime 'a
. If the type\nhas only static references, or none at all, then this may be chosen to be\n'static
.
As of Rust 1.57, this method does not reallocate or shrink the Vec
,\nso the leaked allocation may include unused capacity that is not part\nof the returned slice.
This function is mainly useful for data that lives for the remainder of\nthe program’s life. Dropping the returned reference will cause a memory\nleak.
\nSimple usage:
\n\nlet x = vec![1, 2, 3];\nlet static_ref: &'static mut [usize] = x.leak();\nstatic_ref[0] += 1;\nassert_eq!(static_ref, &[2, 2, 3]);
Returns the remaining spare capacity of the vector as a slice of\nMaybeUninit<T>
.
The returned slice can be used to fill the vector with data (e.g. by\nreading from a file) before marking the data as initialized using the\nset_len
method.
// Allocate vector big enough for 10 elements.\nlet mut v = Vec::with_capacity(10);\n\n// Fill in the first 3 elements.\nlet uninit = v.spare_capacity_mut();\nuninit[0].write(0);\nuninit[1].write(1);\nuninit[2].write(2);\n\n// Mark the first 3 elements of the vector as being initialized.\nunsafe {\n v.set_len(3);\n}\n\nassert_eq!(&v, &[0, 1, 2]);
vec_split_at_spare
)Returns vector content as a slice of T
, along with the remaining spare\ncapacity of the vector as a slice of MaybeUninit<T>
.
The returned spare capacity slice can be used to fill the vector with data\n(e.g. by reading from a file) before marking the data as initialized using\nthe set_len
method.
Note that this is a low-level API, which should be used with care for\noptimization purposes. If you need to append data to a Vec
\nyou can use push
, extend
, extend_from_slice
,\nextend_from_within
, insert
, append
, resize
or\nresize_with
, depending on your exact needs.
#![feature(vec_split_at_spare)]\n\nlet mut v = vec![1, 1, 2];\n\n// Reserve additional space big enough for 10 elements.\nv.reserve(10);\n\nlet (init, uninit) = v.split_at_spare_mut();\nlet sum = init.iter().copied().sum::<u32>();\n\n// Fill in the next 4 elements.\nuninit[0].write(sum);\nuninit[1].write(sum * 2);\nuninit[2].write(sum * 3);\nuninit[3].write(sum * 4);\n\n// Mark the 4 elements of the vector as being initialized.\nunsafe {\n let len = v.len();\n v.set_len(len + 4);\n}\n\nassert_eq!(&v, &[1, 1, 2, 4, 8, 12, 16]);
self
size_of<T> * capacity
). Read moreupcoming
UTF-16\ncode units. The implementation must not assume upcoming
\nto be exact. The caller may write more or fewer code units\nusing write_slice()
and write_char()
. However, the\ncaller should try to give reasonable estimates if it uses\nthis method. Read moreSelf<'a>
’s lifetime. Read moreself
between &'a mut Self<'static>
and &'a mut Self<'a>
,\nand pass it to f
. Read morepub trait ArrayAccessor<Item>where
+ArrayAccessor in vortex::accessor - Rust Trait vortex::accessor::ArrayAccessor
pub trait ArrayAccessor<Item>where
Item: ?Sized,{
// Required method
fn with_iterator<F, R>(&self, f: F) -> Result<R, VortexError>
where F: for<'a> FnOnce(&mut dyn Iterator<Item = Option<&'a Item>>) -> R;
}
Expand description
Trait for arrays that support iterative access to their elements.
-Required Methods§
sourcefn with_iterator<F, R>(&self, f: F) -> Result<R, VortexError>where
+
Required Methods§
fn with_iterator<F, R>(&self, f: F) -> Result<R, VortexError>
Object Safety§
This trait is not object safe.Implementors§
source§impl ArrayAccessor<[u8]> for VarBinArray
source§impl ArrayAccessor<[u8]> for VarBinViewArray
source§impl<T> ArrayAccessor<T> for PrimitiveArraywhere
+
Object Safety§
This trait is not object safe.Implementors§
§impl ArrayAccessor<[u8]> for VarBinArray
§impl ArrayAccessor<[u8]> for VarBinViewArray
§impl<T> ArrayAccessor<T> for PrimitiveArraywhere
T: NativePType,
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_map/index.html b/docs/rust/doc/vortex/aliases/hash_map/index.html
index 4cd2c6218b..5a3ad7e9df 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/index.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/index.html
@@ -1 +1 @@
-vortex::aliases::hash_map - Rust
\ No newline at end of file
+vortex::aliases::hash_map - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_map/type.DefaultHashBuilder.html b/docs/rust/doc/vortex/aliases/hash_map/type.DefaultHashBuilder.html
index 95ca6da864..fcc6cdfdbd 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/type.DefaultHashBuilder.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/type.DefaultHashBuilder.html
@@ -1 +1 @@
-DefaultHashBuilder in vortex::aliases::hash_map - Rust
\ No newline at end of file
+DefaultHashBuilder in vortex::aliases::hash_map - Rust Type Alias vortex::aliases::hash_map::DefaultHashBuilder
pub type DefaultHashBuilder = RandomState;
Aliased Type§
struct DefaultHashBuilder { /* private fields */ }
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_map/type.Entry.html b/docs/rust/doc/vortex/aliases/hash_map/type.Entry.html
index 4712033f93..5fa6b06088 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/type.Entry.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/type.Entry.html
@@ -1,4 +1,4 @@
-Entry in vortex::aliases::hash_map - Rust pub type Entry<'a, K, V, S> = Entry<'a, K, V, S>;
Aliased Type§
enum Entry<'a, K, V, S> {
+Entry in vortex::aliases::hash_map - Rust pub type Entry<'a, K, V, S> = Entry<'a, K, V, S>;
Aliased Type§
enum Entry<'a, K, V, S> {
Occupied(OccupiedEntry<'a, K, V, S>),
Vacant(VacantEntry<'a, K, V, S>),
}
Variants§
§Occupied(OccupiedEntry<'a, K, V, S>)
An occupied entry.
diff --git a/docs/rust/doc/vortex/aliases/hash_map/type.HashMap.html b/docs/rust/doc/vortex/aliases/hash_map/type.HashMap.html
index 5d6cf6cb31..ec1af1a733 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/type.HashMap.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/type.HashMap.html
@@ -1 +1 @@
-HashMap in vortex::aliases::hash_map - Rust
\ No newline at end of file
+HashMap in vortex::aliases::hash_map - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_map/type.HashTable.html b/docs/rust/doc/vortex/aliases/hash_map/type.HashTable.html
index c2d871849a..54d894091b 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/type.HashTable.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/type.HashTable.html
@@ -1 +1 @@
-HashTable in vortex::aliases::hash_map - Rust
\ No newline at end of file
+HashTable in vortex::aliases::hash_map - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_map/type.IntoIter.html b/docs/rust/doc/vortex/aliases/hash_map/type.IntoIter.html
index 531961f84b..35f010f1c5 100644
--- a/docs/rust/doc/vortex/aliases/hash_map/type.IntoIter.html
+++ b/docs/rust/doc/vortex/aliases/hash_map/type.IntoIter.html
@@ -1 +1 @@
-IntoIter in vortex::aliases::hash_map - Rust
\ No newline at end of file
+IntoIter in vortex::aliases::hash_map - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_set/index.html b/docs/rust/doc/vortex/aliases/hash_set/index.html
index d0c6c22280..7fa0deb921 100644
--- a/docs/rust/doc/vortex/aliases/hash_set/index.html
+++ b/docs/rust/doc/vortex/aliases/hash_set/index.html
@@ -1 +1 @@
-vortex::aliases::hash_set - Rust
\ No newline at end of file
+vortex::aliases::hash_set - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_set/type.Entry.html b/docs/rust/doc/vortex/aliases/hash_set/type.Entry.html
index 31f50659dc..3c6cb8bf50 100644
--- a/docs/rust/doc/vortex/aliases/hash_set/type.Entry.html
+++ b/docs/rust/doc/vortex/aliases/hash_set/type.Entry.html
@@ -1,4 +1,4 @@
-Entry in vortex::aliases::hash_set - Rust pub type Entry<'a, V, S> = Entry<'a, V, S>;
Aliased Type§
enum Entry<'a, V, S> {
+Entry in vortex::aliases::hash_set - Rust pub type Entry<'a, V, S> = Entry<'a, V, S>;
Aliased Type§
enum Entry<'a, V, S> {
Occupied(OccupiedEntry<'a, V, S>),
Vacant(VacantEntry<'a, V, S>),
}
Variants§
§Occupied(OccupiedEntry<'a, V, S>)
An occupied entry.
diff --git a/docs/rust/doc/vortex/aliases/hash_set/type.HashSet.html b/docs/rust/doc/vortex/aliases/hash_set/type.HashSet.html
index 52ac4c1024..f82ff552a3 100644
--- a/docs/rust/doc/vortex/aliases/hash_set/type.HashSet.html
+++ b/docs/rust/doc/vortex/aliases/hash_set/type.HashSet.html
@@ -1 +1 @@
-HashSet in vortex::aliases::hash_set - Rust
\ No newline at end of file
+HashSet in vortex::aliases::hash_set - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/hash_set/type.IntoIter.html b/docs/rust/doc/vortex/aliases/hash_set/type.IntoIter.html
index 33a6414c82..a2ea1be990 100644
--- a/docs/rust/doc/vortex/aliases/hash_set/type.IntoIter.html
+++ b/docs/rust/doc/vortex/aliases/hash_set/type.IntoIter.html
@@ -1 +1 @@
-IntoIter in vortex::aliases::hash_set - Rust
\ No newline at end of file
+IntoIter in vortex::aliases::hash_set - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/aliases/index.html b/docs/rust/doc/vortex/aliases/index.html
index a17e9861a0..7af442bf32 100644
--- a/docs/rust/doc/vortex/aliases/index.html
+++ b/docs/rust/doc/vortex/aliases/index.html
@@ -1 +1 @@
-vortex::aliases - Rust
\ No newline at end of file
+vortex::aliases - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/arbitrary/index.html b/docs/rust/doc/vortex/array/arbitrary/index.html
index 90088a9ac8..8dfefba248 100644
--- a/docs/rust/doc/vortex/array/arbitrary/index.html
+++ b/docs/rust/doc/vortex/array/arbitrary/index.html
@@ -1 +1 @@
-vortex::array::arbitrary - Rust
\ No newline at end of file
+vortex::array::arbitrary - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/builder/index.html b/docs/rust/doc/vortex/array/builder/index.html
index 101f26ca90..ad3defa1d6 100644
--- a/docs/rust/doc/vortex/array/builder/index.html
+++ b/docs/rust/doc/vortex/array/builder/index.html
@@ -1 +1 @@
-vortex::array::builder - Rust
\ No newline at end of file
+vortex::array::builder - Rust Structs§
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/builder/struct.VarBinBuilder.html b/docs/rust/doc/vortex/array/builder/struct.VarBinBuilder.html
index f377707399..41299cfe6f 100644
--- a/docs/rust/doc/vortex/array/builder/struct.VarBinBuilder.html
+++ b/docs/rust/doc/vortex/array/builder/struct.VarBinBuilder.html
@@ -1,14 +1,14 @@
-VarBinBuilder in vortex::array::builder - Rust Struct vortex::array::builder::VarBinBuilder
source · pub struct VarBinBuilder<O>where
- O: NativePType,{ /* private fields */ }
Implementations§
source§impl<O> VarBinBuilder<O>where
- O: NativePType,
sourcepub fn new() -> VarBinBuilder<O>
sourcepub fn with_capacity(len: usize) -> VarBinBuilder<O>
sourcepub fn push(&mut self, value: Option<&[u8]>)
sourcepub fn push_value(&mut self, value: impl AsRef<[u8]>)
sourcepub fn push_null(&mut self)
sourcepub fn push_values(
+VarBinBuilder in vortex::array::builder - Rust Struct vortex::array::builder::VarBinBuilder
pub struct VarBinBuilder<O>where
+ O: NativePType,{ /* private fields */ }
Implementations§
§impl<O> VarBinBuilder<O>where
+ O: NativePType,
pub fn new() -> VarBinBuilder<O>
pub fn with_capacity(len: usize) -> VarBinBuilder<O>
pub fn push(&mut self, value: Option<&[u8]>)
pub fn push_value(&mut self, value: impl AsRef<[u8]>)
pub fn push_null(&mut self)
pub fn push_values(
&mut self,
values: &[u8],
end_offsets: impl Iterator<Item = O>,
num: usize,
)where
O: 'static,
- usize: AsPrimitive<O>,
sourcepub fn finish(self, dtype: DType) -> VarBinArray
Trait Implementations§
source§impl<O> Default for VarBinBuilder<O>where
- O: NativePType,
source§fn default() -> VarBinBuilder<O>
Returns the “default value” for a type. Read moreAuto Trait Implementations§
§impl<O> Freeze for VarBinBuilder<O>
§impl<O> RefUnwindSafe for VarBinBuilder<O>
§impl<O> Send for VarBinBuilder<O>
§impl<O> Sync for VarBinBuilder<O>
§impl<O> Unpin for VarBinBuilder<O>where
+ usize: AsPrimitive<O>,
pub fn finish(self, dtype: DType) -> VarBinArray
Trait Implementations§
§impl<O> Default for VarBinBuilder<O>where
+ O: NativePType,
§fn default() -> VarBinBuilder<O>
Returns the “default value” for a type. Read moreAuto Trait Implementations§
§impl<O> Freeze for VarBinBuilder<O>
§impl<O> RefUnwindSafe for VarBinBuilder<O>
§impl<O> Send for VarBinBuilder<O>
§impl<O> Sync for VarBinBuilder<O>
§impl<O> Unpin for VarBinBuilder<O>where
O: Unpin,
§impl<O> UnwindSafe for VarBinBuilder<O>where
O: UnwindSafe,
Blanket Implementations§
source§impl<T> Borrow<T> for Twhere
diff --git a/docs/rust/doc/vortex/array/compute/filter/fn.filter_indices.html b/docs/rust/doc/vortex/array/compute/filter/fn.filter_indices.html
index 8e24facc93..ed3cf6b109 100644
--- a/docs/rust/doc/vortex/array/compute/filter/fn.filter_indices.html
+++ b/docs/rust/doc/vortex/array/compute/filter/fn.filter_indices.html
@@ -1,4 +1,4 @@
-filter_indices in vortex::array::compute::filter - Rust pub fn filter_indices(
+filter_indices in vortex::array::compute::filter - Rust Function vortex::array::compute::filter::filter_indices
pub fn filter_indices(
buffer: &BooleanBuffer,
indices_len: usize,
indices: impl Iterator<Item = usize>,
diff --git a/docs/rust/doc/vortex/array/compute/filter/fn.filter_slices.html b/docs/rust/doc/vortex/array/compute/filter/fn.filter_slices.html
index b76ac2b93b..881b5426b1 100644
--- a/docs/rust/doc/vortex/array/compute/filter/fn.filter_slices.html
+++ b/docs/rust/doc/vortex/array/compute/filter/fn.filter_slices.html
@@ -1,4 +1,4 @@
-filter_slices in vortex::array::compute::filter - Rust pub fn filter_slices(
+filter_slices in vortex::array::compute::filter - Rust Function vortex::array::compute::filter::filter_slices
pub fn filter_slices(
buffer: &BooleanBuffer,
indices_len: usize,
slices: impl Iterator<Item = (usize, usize)>,
diff --git a/docs/rust/doc/vortex/array/compute/filter/index.html b/docs/rust/doc/vortex/array/compute/filter/index.html
index a5d4c18c53..652db24245 100644
--- a/docs/rust/doc/vortex/array/compute/filter/index.html
+++ b/docs/rust/doc/vortex/array/compute/filter/index.html
@@ -1 +1 @@
-vortex::array::compute::filter - Rust Functions§
\ No newline at end of file
+vortex::array::compute::filter - Rust Functions§
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/compute/index.html b/docs/rust/doc/vortex/array/compute/index.html
index 4b99719608..06a2f5dcd5 100644
--- a/docs/rust/doc/vortex/array/compute/index.html
+++ b/docs/rust/doc/vortex/array/compute/index.html
@@ -1 +1 @@
-vortex::array::compute - Rust
\ No newline at end of file
+vortex::array::compute - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/fn.compute_varbin_statistics.html b/docs/rust/doc/vortex/array/fn.compute_varbin_statistics.html
index d0c8c9b545..1ced710b02 100644
--- a/docs/rust/doc/vortex/array/fn.compute_varbin_statistics.html
+++ b/docs/rust/doc/vortex/array/fn.compute_varbin_statistics.html
@@ -1,4 +1,4 @@
-compute_varbin_statistics in vortex::array - Rust Function vortex::array::compute_varbin_statistics
source · pub fn compute_varbin_statistics<T>(
+compute_varbin_statistics in vortex::array - Rust Function vortex::array::compute_varbin_statistics
pub fn compute_varbin_statistics<T>(
array: &T,
stat: Stat,
) -> Result<StatsSet, VortexError>where
diff --git a/docs/rust/doc/vortex/array/fn.varbin_scalar.html b/docs/rust/doc/vortex/array/fn.varbin_scalar.html
index ade9b8f66e..ce0e63964a 100644
--- a/docs/rust/doc/vortex/array/fn.varbin_scalar.html
+++ b/docs/rust/doc/vortex/array/fn.varbin_scalar.html
@@ -1 +1 @@
-varbin_scalar in vortex::array - Rust Function vortex::array::varbin_scalar
source · pub fn varbin_scalar(value: Buffer, dtype: &DType) -> Scalar
\ No newline at end of file
+varbin_scalar in vortex::array - Rust Function vortex::array::varbin_scalar
pub fn varbin_scalar(value: Buffer, dtype: &DType) -> Scalar
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/from/index.html b/docs/rust/doc/vortex/array/from/index.html
index 1634789ecf..ebf4c369a0 100644
--- a/docs/rust/doc/vortex/array/from/index.html
+++ b/docs/rust/doc/vortex/array/from/index.html
@@ -1 +1 @@
-vortex::array::from - Rust
\ No newline at end of file
+vortex::array::from - Rust
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/index.html b/docs/rust/doc/vortex/array/index.html
index ec706ddd58..5bbcf10ad3 100644
--- a/docs/rust/doc/vortex/array/index.html
+++ b/docs/rust/doc/vortex/array/index.html
@@ -1,2 +1,2 @@
-vortex::array - Rust Expand description
All the built-in encoding schemes and arrays.
+vortex::array - Rust Expand description
All the built-in encoding schemes and arrays.
Modules§
Structs§
- The array encoding
- A slice-able [
Buffer
] containing bit-packed booleans - The array encoding
- The array encoding
- The array encoding
- The array encoding
- The array encoding
- The array encoding
- The array encoding
- The array encoding
- An array wrapper for primitive values that have an associated temporal meaning.
- The array encoding
- The array encoding
Functions§
Unions§
\ No newline at end of file
diff --git a/docs/rust/doc/vortex/array/struct.BoolArray.html b/docs/rust/doc/vortex/array/struct.BoolArray.html
index 51bddab39b..1a5885b51e 100644
--- a/docs/rust/doc/vortex/array/struct.BoolArray.html
+++ b/docs/rust/doc/vortex/array/struct.BoolArray.html
@@ -1,86 +1,86 @@
-BoolArray in vortex::array - Rust pub struct BoolArray(/* private fields */);
Implementations§
source§impl BoolArray
sourcepub fn maybe_from(data: ArrayData) -> Option<BoolArray>
Optionally downcast an ArrayData
instance to a specific encoding.
+BoolArray in vortex::array - Rust pub struct BoolArray(/* private fields */);
Implementations§
§impl BoolArray
pub fn maybe_from(data: ArrayData) -> Option<BoolArray>
Optionally downcast an ArrayData
instance to a specific encoding.
Preferred in cases where a backtrace isn’t needed, like when trying multiple encoding to go
down different code paths.
-source§impl BoolArray
sourcepub fn into_buffer(self) -> Buffer
Convert array into its internal buffer
-sourcepub fn boolean_buffer(&self) -> BooleanBuffer
Get array values as an arrow BooleanBuffer
-sourcepub fn into_boolean_builder(self) -> (BooleanBufferBuilder, usize)
Get a mutable version of this array.
+§impl BoolArray
pub fn buffer(&self) -> &Buffer
Access internal array buffer
+pub fn into_buffer(self) -> Buffer
Convert array into its internal buffer
+pub fn boolean_buffer(&self) -> BooleanBuffer
Get array values as an arrow BooleanBuffer
+pub fn into_boolean_builder(self) -> (BooleanBufferBuilder, usize)
Get a mutable version of this array.
If the caller holds the only reference to the underlying buffer the underlying buffer is returned
otherwise a copy is created.
The second value of the tuple is a bit_offset of first value in first byte of the returned builder
-sourcepub fn validity(&self) -> Validity
sourcepub fn new(buffer: BooleanBuffer, nullability: Nullability) -> BoolArray
Create a new BoolArray from a buffer and nullability.
-pub fn validity(&self) -> Validity
pub fn new(buffer: BooleanBuffer, nullability: Nullability) -> BoolArray
Create a new BoolArray from a buffer and nullability.
+pub fn try_new(
buffer: BooleanBuffer,
validity: Validity,
) -> Result<BoolArray, VortexError>
Create a new BoolArray from a buffer and validity metadata.
Returns an error if the validity length does not match the buffer length.
-sourcepub fn from_indices<I>(length: usize, indices: I) -> BoolArraywhere
+
pub fn from_indices<I>(length: usize, indices: I) -> BoolArraywhere
I: IntoIterator<Item = usize>,
Create a new BoolArray from a set of indices and a length.
All indices must be less than the length.
-Trait Implementations§
Trait Implementations§
§impl FillForwardFn<BoolArray> for BoolEncoding
§fn fill_forward(&self, array: &BoolArray) -> Result<ArrayData, VortexError>
§impl FillNullFn<BoolArray> for BoolEncoding
source§impl FilterFn<BoolArray> for BoolEncoding
§impl FilterFn<BoolArray> for BoolEncoding
source§impl From<BooleanBuffer> for BoolArray
source§fn from(value: BooleanBuffer) -> BoolArray
Converts to this type from the input type.source§impl FromIterator<bool> for BoolArray
source§impl IntoArrayData for BoolArray
source§fn into_array(self) -> ArrayData
source§impl IntoCanonical for BoolArray
source§impl InvertFn<BoolArray> for BoolEncoding
source§impl ScalarAtFn<BoolArray> for BoolEncoding
§impl From<BooleanBuffer> for BoolArray
§fn from(value: BooleanBuffer) -> BoolArray
Converts to this type from the input type.§impl FromIterator<Option<bool>> for BoolArray
§impl FromIterator<bool> for BoolArray
§impl IntoArrayData for BoolArray
§fn into_array(self) -> ArrayData
§impl IntoCanonical for BoolArray
§fn into_canonical(self) -> Result<Canonical, VortexError>
§fn into_arrow(self) -> Result<Arc<dyn Array>, VortexError>where
+ Self: Sized,
§impl InvertFn<BoolArray> for BoolEncoding
§impl ScalarAtFn<BoolArray> for BoolEncoding
§impl SliceFn<BoolArray> for BoolEncoding
§fn slice(
&self,
array: &BoolArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<BoolArray> for BoolEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<BoolArray> for BoolEncoding
source§impl TakeFn<BoolArray> for BoolEncoding
§impl TakeFn<BoolArray> for BoolEncoding
source§impl ValidityVTable<BoolArray> for BoolEncoding
source§impl VariantsVTable<BoolArray> for BoolEncoding
source§fn as_bool_array<'a>(
+given indices
. Read more
§impl ValidityVTable<BoolArray> for BoolEncoding
§fn is_valid(&self, array: &BoolArray, index: usize) -> bool
§fn logical_validity(&self, array: &BoolArray) -> LogicalValidity
§impl VariantsVTable<BoolArray> for BoolEncoding
§fn as_bool_array<'a>(
&self,
array: &'a BoolArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_null_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn NullArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_null_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn NullArrayTrait>
§fn as_primitive_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<BoolArray> for BoolEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<BoolArray> for BoolEncoding
source§impl ArrayTrait for BoolArray
source§impl BoolArrayTrait for BoolArray
Auto Trait Implementations§
§impl !Freeze for BoolArray
§impl !RefUnwindSafe for BoolArray
§impl Send for BoolArray
§impl Sync for BoolArray
§impl Unpin for BoolArray
§impl !UnwindSafe for BoolArray
Blanket Implementations§
source§impl<T> ArrayEncodingRef for T
source§fn encoding(&self) -> &'static dyn EncodingVTable
source§impl<A> ArrayNBytes for A
source§impl<T> ArrayStatistics for T
source§fn statistics(&self) -> &dyn Statistics
source§fn inherit_statistics(&self, parent: &dyn Statistics)
source§impl<A> ArrayValidity for A
source§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
-source§fn logical_validity(&self) -> LogicalValidity
§impl ArrayTrait for BoolArray
§impl BoolArrayTrait for BoolArray
Auto Trait Implementations§
§impl !Freeze for BoolArray
§impl !RefUnwindSafe for BoolArray
§impl Send for BoolArray
§impl Sync for BoolArray
§impl Unpin for BoolArray
§impl !UnwindSafe for BoolArray
Blanket Implementations§
§impl<T> ArrayEncodingRef for T
§fn encoding(&self) -> &'static dyn EncodingVTable
§impl<A> ArrayNBytes for A
§impl<T> ArrayStatistics for T
§fn statistics(&self) -> &dyn Statistics
§fn inherit_statistics(&self, parent: &dyn Statistics)
§impl<A> ArrayValidity for A
§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
+§fn logical_validity(&self) -> LogicalValidity
Return the logical validity of the array.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> CloneToUninit for Twhere
@@ -91,16 +91,16 @@
U: From<T>,
source§impl<T> IntoArrayVariant for Twhere
- T: IntoCanonical,
source§fn into_null(self) -> Result<NullArray, VortexError>
source§fn into_bool(self) -> Result<BoolArray, VortexError>
source§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
source§fn into_struct(self) -> Result<StructArray, VortexError>
source§fn into_list(self) -> Result<ListArray, VortexError>
source§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
source§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
§impl<T> IntoArrayVariant for Twhere
+ T: IntoCanonical,
§fn into_null(self) -> Result<NullArray, VortexError>
§fn into_bool(self) -> Result<BoolArray, VortexError>
§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
§fn into_struct(self) -> Result<StructArray, VortexError>
§fn into_list(self) -> Result<ListArray, VortexError>
§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read more§impl<V, T> VZip<V> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.BoolEncoding.html b/docs/rust/doc/vortex/array/struct.BoolEncoding.html
index c6edec9b01..5634fb04f4 100644
--- a/docs/rust/doc/vortex/array/struct.BoolEncoding.html
+++ b/docs/rust/doc/vortex/array/struct.BoolEncoding.html
@@ -1,62 +1,62 @@
-BoolEncoding in vortex::array - Rust Struct vortex::array::BoolEncoding
source · pub struct BoolEncoding;
Expand description
The array encoding
-Trait Implementations§
source§impl ComputeVTable for BoolEncoding
source§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read moresource§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read moresource§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read moresource§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read moresource§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read moresource§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read moresource§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read moresource§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
-the receiver. Read moresource§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read moresource§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read moresource§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read moresource§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read moresource§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read moresource§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read moresource§impl Debug for BoolEncoding
source§impl Encoding for BoolEncoding
source§impl EncodingVTable for BoolEncoding
source§impl FillForwardFn<BoolArray> for BoolEncoding
source§impl FillNullFn<BoolArray> for BoolEncoding
source§fn fill_null(
+BoolEncoding in vortex::array - Rust Struct vortex::array::BoolEncoding
pub struct BoolEncoding;
Expand description
The array encoding
+Trait Implementations§
§impl ComputeVTable for BoolEncoding
§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read more§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read more§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read more§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read more§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read more§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read more§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read more§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
+the receiver. Read more§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read more§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read more§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read more§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read more§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read more§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read more§impl Debug for BoolEncoding
§impl Encoding for BoolEncoding
§impl EncodingVTable for BoolEncoding
§impl FillForwardFn<BoolArray> for BoolEncoding
§fn fill_forward(&self, array: &BoolArray) -> Result<ArrayData, VortexError>
§impl FillNullFn<BoolArray> for BoolEncoding
source§impl FilterFn<BoolArray> for BoolEncoding
§impl FilterFn<BoolArray> for BoolEncoding
source§impl InvertFn<BoolArray> for BoolEncoding
source§impl ScalarAtFn<BoolArray> for BoolEncoding
§impl InvertFn<BoolArray> for BoolEncoding
§impl ScalarAtFn<BoolArray> for BoolEncoding
§impl SliceFn<BoolArray> for BoolEncoding
§fn slice(
&self,
array: &BoolArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<BoolArray> for BoolEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<BoolArray> for BoolEncoding
source§impl StatisticsVTable<BooleanBuffer> for BoolEncoding
source§fn compute_statistics(
+) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.§impl StatisticsVTable<BooleanBuffer> for BoolEncoding
§fn compute_statistics(
&self,
buffer: &BooleanBuffer,
stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl StatisticsVTable<NullableBools<'_>> for BoolEncoding
source§fn compute_statistics(
+) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.§impl StatisticsVTable<NullableBools<'_>> for BoolEncoding
§fn compute_statistics(
&self,
array: &NullableBools<'_>,
stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl TakeFn<BoolArray> for BoolEncoding
§impl TakeFn<BoolArray> for BoolEncoding
source§impl ValidityVTable<BoolArray> for BoolEncoding
source§impl VariantsVTable<BoolArray> for BoolEncoding
source§fn as_bool_array<'a>(
+given indices
. Read more
§impl ValidityVTable<BoolArray> for BoolEncoding
§fn is_valid(&self, array: &BoolArray, index: usize) -> bool
§fn logical_validity(&self, array: &BoolArray) -> LogicalValidity
§impl VariantsVTable<BoolArray> for BoolEncoding
§fn as_bool_array<'a>(
&self,
array: &'a BoolArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_null_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn NullArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_null_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn NullArrayTrait>
§fn as_primitive_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
_array: &'a Array,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<BoolArray> for BoolEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<BoolArray> for BoolEncoding
§fn accept(
&self,
array: &BoolArray,
visitor: &mut dyn ArrayVisitor,
@@ -77,9 +77,9 @@
F: FnOnce(&Self) -> bool,
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read moresource§impl<E> MetadataVTable for Ewhere
+otherwise. Read more
§impl<E> MetadataVTable for E
source§fn load_metadata(
+ <E as Encoding>::Metadata: for<'m> TryDeserializeArrayMetadata<'m>,
§fn load_metadata(
&self,
metadata: Option<&[u8]>,
) -> Result<Arc<dyn ArrayMetadata>, VortexError>
source§impl<T, U> TryFrom<U> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.BoolMetadata.html b/docs/rust/doc/vortex/array/struct.BoolMetadata.html
index aa120bc2aa..d88e3767d3 100644
--- a/docs/rust/doc/vortex/array/struct.BoolMetadata.html
+++ b/docs/rust/doc/vortex/array/struct.BoolMetadata.html
@@ -1,8 +1,8 @@
-BoolMetadata in vortex::array - Rust Struct vortex::array::BoolMetadata
source · pub struct BoolMetadata { /* private fields */ }
Trait Implementations§
source§impl ArrayMetadata for BoolMetadata
Implement ArrayMetadata
-source§impl Clone for BoolMetadata
source§fn clone(&self) -> BoolMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moresource§impl Debug for BoolMetadata
source§impl<'de> Deserialize<'de> for BoolMetadata
source§fn deserialize<__D>(
+BoolMetadata in vortex::array - Rust Struct vortex::array::BoolMetadata
pub struct BoolMetadata { /* private fields */ }
Trait Implementations§
§impl ArrayMetadata for BoolMetadata
Implement ArrayMetadata
+§impl Clone for BoolMetadata
§fn clone(&self) -> BoolMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl Debug for BoolMetadata
§impl<'de> Deserialize<'de> for BoolMetadata
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BoolMetadata, <__D as Deserializer<'de>>::Error>where
- __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read moresource§impl Display for BoolMetadata
source§impl Serialize for BoolMetadata
source§fn serialize<__S>(
+ __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more§impl Display for BoolMetadata
§impl Serialize for BoolMetadata
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
@@ -27,13 +27,13 @@
otherwise. Read more
source§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
- M: Deserialize<'de>,
source§fn try_deserialize_metadata(
+ T: Display + ?Sized,
§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
+ M: Deserialize<'de>,
§fn try_deserialize_metadata(
metadata: Option<&'de [u8]>,
) -> Result<M, VortexError>
source§impl<M> TrySerializeArrayMetadata for Mwhere
- M: Serialize,
§impl<M> TrySerializeArrayMetadata for Mwhere
+ M: Serialize,
§fn try_serialize_metadata(&self) -> Result<Arc<[u8]>, VortexError>
§impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
diff --git a/docs/rust/doc/vortex/array/struct.BooleanBuffer.html b/docs/rust/doc/vortex/array/struct.BooleanBuffer.html
index 9e275d27a8..488c9c26ec 100644
--- a/docs/rust/doc/vortex/array/struct.BooleanBuffer.html
+++ b/docs/rust/doc/vortex/array/struct.BooleanBuffer.html
@@ -42,9 +42,9 @@ §Safety
) -> <&BooleanBuffer as BitOr<&BooleanBuffer>>::OutputPerforms the |
operation. Read more§impl BitXor<&BooleanBuffer> for &BooleanBuffer
§type Output = BooleanBuffer
The resulting type after applying the ^
operator.§fn bitxor(
self,
rhs: &BooleanBuffer,
-) -> <&BooleanBuffer as BitXor<&BooleanBuffer>>::Output
Performs the ^
operation. Read more§impl Clone for BooleanBuffer
§fn clone(&self) -> BooleanBuffer
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl Debug for BooleanBuffer
§impl From<&[bool]> for BooleanBuffer
§fn from(value: &[bool]) -> BooleanBuffer
Converts to this type from the input type.source§impl From<BooleanBuffer> for ArrayData
source§fn from(value: BooleanBuffer) -> ArrayData
Converts to this type from the input type.source§impl From<BooleanBuffer> for BoolArray
source§fn from(value: BooleanBuffer) -> BoolArray
Converts to this type from the input type.source§impl From<BooleanBuffer> for FilterMask
source§fn from(value: BooleanBuffer) -> FilterMask
Converts to this type from the input type.source§impl From<BooleanBuffer> for Validity
source§fn from(value: BooleanBuffer) -> Validity
Converts to this type from the input type.§impl From<BooleanBufferBuilder> for BooleanBuffer
§fn from(builder: BooleanBufferBuilder) -> BooleanBuffer
Converts to this type from the input type.§impl From<Vec<bool>> for BooleanBuffer
§fn from(value: Vec<bool>) -> BooleanBuffer
Converts to this type from the input type.§impl FromIterator<bool> for BooleanBuffer
§fn from_iter<T>(iter: T) -> BooleanBuffer
§impl Clone for BooleanBuffer
§fn clone(&self) -> BooleanBuffer
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl Debug for BooleanBuffer
§impl From<&[bool]> for BooleanBuffer
§fn from(value: &[bool]) -> BooleanBuffer
Converts to this type from the input type.§impl From<BooleanBuffer> for ArrayData
§fn from(value: BooleanBuffer) -> ArrayData
Converts to this type from the input type.§impl From<BooleanBuffer> for BoolArray
§fn from(value: BooleanBuffer) -> BoolArray
Converts to this type from the input type.§impl From<BooleanBuffer> for FilterMask
§fn from(value: BooleanBuffer) -> FilterMask
Converts to this type from the input type.§impl From<BooleanBuffer> for Validity
§fn from(value: BooleanBuffer) -> Validity
Converts to this type from the input type.§impl From<BooleanBufferBuilder> for BooleanBuffer
§fn from(builder: BooleanBufferBuilder) -> BooleanBuffer
Converts to this type from the input type.§impl From<Vec<bool>> for BooleanBuffer
§fn from(value: Vec<bool>) -> BooleanBuffer
Converts to this type from the input type.§impl FromIterator<bool> for BooleanBuffer
§fn from_iter<T>(iter: T) -> BooleanBufferwhere
T: IntoIterator<Item = bool>,
Creates a value from an iterator. Read more§impl<'a> IntoIterator for &'a BooleanBuffer
§impl Not for &BooleanBuffer
§type Output = BooleanBuffer
The resulting type after applying the !
operator.§impl PartialEq for BooleanBuffer
source§impl StatisticsVTable<BooleanBuffer> for BoolEncoding
source§fn compute_statistics(
+and should not be overridden without very good reason.
§impl StatisticsVTable<BooleanBuffer> for BoolEncoding
§fn compute_statistics(
&self,
buffer: &BooleanBuffer,
stat: Stat,
diff --git a/docs/rust/doc/vortex/array/struct.Buffers.html b/docs/rust/doc/vortex/array/struct.Buffers.html
index b62c7b102a..1d69c0f33d 100644
--- a/docs/rust/doc/vortex/array/struct.Buffers.html
+++ b/docs/rust/doc/vortex/array/struct.Buffers.html
@@ -1,4 +1,4 @@
-Buffers in vortex::array - Rust pub struct Buffers<'a> { /* private fields */ }
Trait Implementations§
source§impl Iterator for Buffers<'_>
source§fn next(&mut self) -> Option<<Buffers<'_> as Iterator>::Item>
Advances the iterator and returns the next value. Read moresource§fn next_chunk<const N: usize>(
+Buffers in vortex::array - Rust pub struct Buffers<'a> { /* private fields */ }
Trait Implementations§
§impl Iterator for Buffers<'_>
§fn next(&mut self) -> Option<<Buffers<'_> as Iterator>::Item>
Advances the iterator and returns the next value. Read moresource§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
🔬This is a nightly-only experimental API. (iter_next_chunk
)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 · source§fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read more1.0.0 · source§fn count(self) -> usizewhere
diff --git a/docs/rust/doc/vortex/array/struct.ChunkedArray.html b/docs/rust/doc/vortex/array/struct.ChunkedArray.html
index 2e20e16d7d..fd0314ab32 100644
--- a/docs/rust/doc/vortex/array/struct.ChunkedArray.html
+++ b/docs/rust/doc/vortex/array/struct.ChunkedArray.html
@@ -1,105 +1,105 @@
-ChunkedArray in vortex::array - Rust Struct vortex::array::ChunkedArray
source · pub struct ChunkedArray(/* private fields */);
Implementations§
source§impl ChunkedArray
sourcepub fn maybe_from(data: ArrayData) -> Option<ChunkedArray>
Optionally downcast an ArrayData
instance to a specific encoding.
+ChunkedArray in vortex::array - Rust Struct vortex::array::ChunkedArray
pub struct ChunkedArray(/* private fields */);
Implementations§
§impl ChunkedArray
pub fn maybe_from(data: ArrayData) -> Option<ChunkedArray>
Optionally downcast an ArrayData
instance to a specific encoding.
Preferred in cases where a backtrace isn’t needed, like when trying multiple encoding to go
down different code paths.
-source§impl ChunkedArray
§impl ChunkedArray
pub fn try_new(
chunks: Vec<ArrayData>,
dtype: DType,
-) -> Result<ChunkedArray, VortexError>
sourcepub fn chunk(&self, idx: usize) -> Result<ArrayData, VortexError>
sourcepub fn nchunks(&self) -> usize
sourcepub fn chunk_offsets(&self) -> ArrayData
sourcepub fn chunks(&self) -> impl Iterator<Item = ArrayData>
sourcepub fn array_iterator(&self) -> impl ArrayIterator
sourcepub fn array_stream(&self) -> impl ArrayStream
sourcepub fn rechunk(
+) -> Result<ChunkedArray, VortexError>
pub fn chunk(&self, idx: usize) -> Result<ArrayData, VortexError>
pub fn nchunks(&self) -> usize
pub fn chunk_offsets(&self) -> ArrayData
pub fn chunks(&self) -> impl Iterator<Item = ArrayData>
pub fn array_iterator(&self) -> impl ArrayIterator
pub fn array_stream(&self) -> impl ArrayStream
pub fn rechunk(
&self,
target_bytesize: usize,
target_rowsize: usize,
-) -> Result<ChunkedArray, VortexError>
Trait Implementations§
source§impl AsRef<ArrayData> for ChunkedArray
source§impl BinaryBooleanFn<ChunkedArray> for ChunkedEncoding
source§fn binary_boolean(
+) -> Result<ChunkedArray, VortexError>
Trait Implementations§
§impl AsRef<ArrayData> for ChunkedArray
§impl BinaryBooleanFn<ChunkedArray> for ChunkedEncoding
§fn binary_boolean(
&self,
lhs: &ChunkedArray,
rhs: &ArrayData,
op: BinaryOperator,
-) -> Result<Option<ArrayData>, VortexError>
source§impl CastFn<ChunkedArray> for ChunkedEncoding
§impl CastFn<ChunkedArray> for ChunkedEncoding
§fn cast(
&self,
array: &ChunkedArray,
dtype: &DType,
-) -> Result<ArrayData, VortexError>
source§impl Clone for ChunkedArray
source§fn clone(&self) -> ChunkedArray
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moresource§impl CompareFn<ChunkedArray> for ChunkedEncoding
§impl Clone for ChunkedArray
§fn clone(&self) -> ChunkedArray
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl CompareFn<ChunkedArray> for ChunkedEncoding
source§impl Debug for ChunkedArray
source§impl ExtensionArrayTrait for ChunkedArray
source§impl FillNullFn<ChunkedArray> for ChunkedEncoding
§impl Debug for ChunkedArray
§impl ExtensionArrayTrait for ChunkedArray
§impl FillNullFn<ChunkedArray> for ChunkedEncoding
source§impl FilterFn<ChunkedArray> for ChunkedEncoding
§impl FilterFn<ChunkedArray> for ChunkedEncoding
§fn filter(
&self,
array: &ChunkedArray,
mask: FilterMask,
-) -> Result<ArrayData, VortexError>
Filter an array by the provided predicate.source§impl FromIterator<ArrayData> for ChunkedArray
source§fn from_iter<T>(iter: T) -> ChunkedArraywhere
- T: IntoIterator<Item = ArrayData>,
Creates a value from an iterator. Read moresource§impl IntoArrayData for ChunkedArray
source§fn into_array(self) -> ArrayData
source§impl IntoCanonical for ChunkedArray
source§impl InvertFn<ChunkedArray> for ChunkedEncoding
source§impl PrimitiveArrayTrait for ChunkedArray
source§impl ScalarAtFn<ChunkedArray> for ChunkedEncoding
§impl FromIterator<ArrayData> for ChunkedArray
§fn from_iter<T>(iter: T) -> ChunkedArraywhere
+ T: IntoIterator<Item = ArrayData>,
Creates a value from an iterator. Read more§impl IntoArrayData for ChunkedArray
§fn into_array(self) -> ArrayData
§impl IntoCanonical for ChunkedArray
§fn into_canonical(self) -> Result<Canonical, VortexError>
§fn into_arrow(self) -> Result<Arc<dyn Array>, VortexError>where
+ Self: Sized,
§impl InvertFn<ChunkedArray> for ChunkedEncoding
§fn invert(&self, array: &ChunkedArray) -> Result<ArrayData, VortexError>
Logically invert a boolean array. Converts true -> false, false -> true, null -> null.§impl PrimitiveArrayTrait for ChunkedArray
§impl ScalarAtFn<ChunkedArray> for ChunkedEncoding
source§impl SliceFn<ChunkedArray> for ChunkedEncoding
§impl SliceFn<ChunkedArray> for ChunkedEncoding
§fn slice(
&self,
array: &ChunkedArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<ChunkedArray> for ChunkedEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<ChunkedArray> for ChunkedEncoding
§fn compute_statistics(
&self,
array: &ChunkedArray,
stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl StructArrayTrait for ChunkedArray
source§impl SubtractScalarFn<ChunkedArray> for ChunkedEncoding
source§fn subtract_scalar(
+) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.§impl StructArrayTrait for ChunkedArray
§impl SubtractScalarFn<ChunkedArray> for ChunkedEncoding
§fn subtract_scalar(
&self,
array: &ChunkedArray,
- to_subtract: &Scalar,
-) -> Result<ArrayData, VortexError>
source§impl TakeFn<ChunkedArray> for ChunkedEncoding
§impl TakeFn<ChunkedArray> for ChunkedEncoding
source§impl<'a> TryFrom<&'a ArrayData> for &'a ChunkedArray
source§impl TryFrom<ArrayData> for ChunkedArray
source§impl ValidityVTable<ChunkedArray> for ChunkedEncoding
source§fn is_valid(&self, array: &ChunkedArray, index: usize) -> bool
source§fn logical_validity(&self, array: &ChunkedArray) -> LogicalValidity
source§impl VariantsVTable<ChunkedArray> for ChunkedEncoding
Chunked arrays support all DTypes
-source§fn as_null_array<'a>(
+given indices
. Read more
§impl<'a> TryFrom<&'a ArrayData> for &'a ChunkedArray
§impl TryFrom<ArrayData> for ChunkedArray
§impl ValidityVTable<ChunkedArray> for ChunkedEncoding
§fn is_valid(&self, array: &ChunkedArray, index: usize) -> bool
§fn logical_validity(&self, array: &ChunkedArray) -> LogicalValidity
§impl VariantsVTable<ChunkedArray> for ChunkedEncoding
Chunked arrays support all DTypes
+§fn as_null_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn NullArrayTrait>
source§fn as_bool_array<'a>(
+) -> Option<&'a dyn NullArrayTrait>
§fn as_bool_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_primitive_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<ChunkedArray> for ChunkedEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<ChunkedArray> for ChunkedEncoding
§fn accept(
&self,
array: &ChunkedArray,
visitor: &mut dyn ArrayVisitor,
-) -> Result<(), VortexError>
source§impl ArrayTrait for ChunkedArray
source§impl BinaryArrayTrait for ChunkedArray
source§impl BoolArrayTrait for ChunkedArray
source§impl ListArrayTrait for ChunkedArray
source§impl NullArrayTrait for ChunkedArray
source§impl Utf8ArrayTrait for ChunkedArray
Auto Trait Implementations§
§impl !Freeze for ChunkedArray
§impl !RefUnwindSafe for ChunkedArray
§impl Send for ChunkedArray
§impl Sync for ChunkedArray
§impl Unpin for ChunkedArray
§impl !UnwindSafe for ChunkedArray
Blanket Implementations§
source§impl<T> ArrayEncodingRef for T
source§fn encoding(&self) -> &'static dyn EncodingVTable
source§impl<A> ArrayNBytes for A
source§impl<T> ArrayStatistics for T
source§fn statistics(&self) -> &dyn Statistics
source§fn inherit_statistics(&self, parent: &dyn Statistics)
source§impl<A> ArrayValidity for A
source§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
-source§fn logical_validity(&self) -> LogicalValidity
§impl ArrayTrait for ChunkedArray
§impl BinaryArrayTrait for ChunkedArray
§impl BoolArrayTrait for ChunkedArray
§impl ListArrayTrait for ChunkedArray
§impl NullArrayTrait for ChunkedArray
§impl Utf8ArrayTrait for ChunkedArray
Auto Trait Implementations§
§impl !Freeze for ChunkedArray
§impl !RefUnwindSafe for ChunkedArray
§impl Send for ChunkedArray
§impl Sync for ChunkedArray
§impl Unpin for ChunkedArray
§impl !UnwindSafe for ChunkedArray
Blanket Implementations§
§impl<T> ArrayEncodingRef for T
§fn encoding(&self) -> &'static dyn EncodingVTable
§impl<A> ArrayNBytes for A
§impl<T> ArrayStatistics for T
§fn statistics(&self) -> &dyn Statistics
§fn inherit_statistics(&self, parent: &dyn Statistics)
§impl<A> ArrayValidity for A
§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
+§fn logical_validity(&self) -> LogicalValidity
Return the logical validity of the array.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> CloneToUninit for Twhere
@@ -110,16 +110,16 @@
U: From<T>,
source§impl<T> IntoArrayVariant for Twhere
- T: IntoCanonical,
source§fn into_null(self) -> Result<NullArray, VortexError>
source§fn into_bool(self) -> Result<BoolArray, VortexError>
source§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
source§fn into_struct(self) -> Result<StructArray, VortexError>
source§fn into_list(self) -> Result<ListArray, VortexError>
source§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
source§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
§impl<T> IntoArrayVariant for Twhere
+ T: IntoCanonical,
§fn into_null(self) -> Result<NullArray, VortexError>
§fn into_bool(self) -> Result<BoolArray, VortexError>
§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
§fn into_struct(self) -> Result<StructArray, VortexError>
§fn into_list(self) -> Result<ListArray, VortexError>
§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read more§impl<V, T> VZip<V> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.ChunkedEncoding.html b/docs/rust/doc/vortex/array/struct.ChunkedEncoding.html
index 0d58e5f628..6328febc5b 100644
--- a/docs/rust/doc/vortex/array/struct.ChunkedEncoding.html
+++ b/docs/rust/doc/vortex/array/struct.ChunkedEncoding.html
@@ -1,83 +1,83 @@
-ChunkedEncoding in vortex::array - Rust Struct vortex::array::ChunkedEncoding
source · pub struct ChunkedEncoding;
Expand description
The array encoding
-Trait Implementations§
source§impl BinaryBooleanFn<ChunkedArray> for ChunkedEncoding
source§fn binary_boolean(
+ChunkedEncoding in vortex::array - Rust Struct vortex::array::ChunkedEncoding
pub struct ChunkedEncoding;
Expand description
The array encoding
+Trait Implementations§
§impl BinaryBooleanFn<ChunkedArray> for ChunkedEncoding
§fn binary_boolean(
&self,
lhs: &ChunkedArray,
rhs: &ArrayData,
op: BinaryOperator,
-) -> Result<Option<ArrayData>, VortexError>
source§impl CastFn<ChunkedArray> for ChunkedEncoding
§impl CastFn<ChunkedArray> for ChunkedEncoding
§fn cast(
&self,
array: &ChunkedArray,
dtype: &DType,
-) -> Result<ArrayData, VortexError>
source§impl CompareFn<ChunkedArray> for ChunkedEncoding
§impl CompareFn<ChunkedArray> for ChunkedEncoding
source§impl ComputeVTable for ChunkedEncoding
source§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read moresource§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read moresource§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read moresource§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read moresource§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read moresource§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read moresource§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read moresource§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read moresource§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read moresource§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
-the receiver. Read moresource§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read moresource§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read moresource§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read moresource§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read moresource§impl Debug for ChunkedEncoding
source§impl Encoding for ChunkedEncoding
source§const ID: EncodingId = _
source§type Array = ChunkedArray
source§type Metadata = ChunkedMetadata
source§impl EncodingVTable for ChunkedEncoding
source§impl FillNullFn<ChunkedArray> for ChunkedEncoding
§impl ComputeVTable for ChunkedEncoding
§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read more§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read more§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read more§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read more§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read more§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read more§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read more§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read more§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read more§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
+the receiver. Read more§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read more§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read more§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read more§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read more§impl Debug for ChunkedEncoding
§impl Encoding for ChunkedEncoding
§impl EncodingVTable for ChunkedEncoding
§impl FillNullFn<ChunkedArray> for ChunkedEncoding
source§impl FilterFn<ChunkedArray> for ChunkedEncoding
§impl FilterFn<ChunkedArray> for ChunkedEncoding
§fn filter(
&self,
array: &ChunkedArray,
mask: FilterMask,
-) -> Result<ArrayData, VortexError>
Filter an array by the provided predicate.source§impl InvertFn<ChunkedArray> for ChunkedEncoding
source§impl ScalarAtFn<ChunkedArray> for ChunkedEncoding
§impl InvertFn<ChunkedArray> for ChunkedEncoding
§fn invert(&self, array: &ChunkedArray) -> Result<ArrayData, VortexError>
Logically invert a boolean array. Converts true -> false, false -> true, null -> null.§impl ScalarAtFn<ChunkedArray> for ChunkedEncoding
source§impl SliceFn<ChunkedArray> for ChunkedEncoding
§impl SliceFn<ChunkedArray> for ChunkedEncoding
§fn slice(
&self,
array: &ChunkedArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<ChunkedArray> for ChunkedEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<ChunkedArray> for ChunkedEncoding
§fn compute_statistics(
&self,
array: &ChunkedArray,
stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl SubtractScalarFn<ChunkedArray> for ChunkedEncoding
source§fn subtract_scalar(
+) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.§impl SubtractScalarFn<ChunkedArray> for ChunkedEncoding
§fn subtract_scalar(
&self,
array: &ChunkedArray,
- to_subtract: &Scalar,
-) -> Result<ArrayData, VortexError>
source§impl TakeFn<ChunkedArray> for ChunkedEncoding
§impl TakeFn<ChunkedArray> for ChunkedEncoding
source§impl ValidityVTable<ChunkedArray> for ChunkedEncoding
source§fn is_valid(&self, array: &ChunkedArray, index: usize) -> bool
source§fn logical_validity(&self, array: &ChunkedArray) -> LogicalValidity
source§impl VariantsVTable<ChunkedArray> for ChunkedEncoding
Chunked arrays support all DTypes
-source§fn as_null_array<'a>(
+given indices
. Read more
§impl ValidityVTable<ChunkedArray> for ChunkedEncoding
§fn is_valid(&self, array: &ChunkedArray, index: usize) -> bool
§fn logical_validity(&self, array: &ChunkedArray) -> LogicalValidity
§impl VariantsVTable<ChunkedArray> for ChunkedEncoding
Chunked arrays support all DTypes
+§fn as_null_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn NullArrayTrait>
source§fn as_bool_array<'a>(
+) -> Option<&'a dyn NullArrayTrait>
§fn as_bool_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_primitive_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
array: &'a ChunkedArray,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<ChunkedArray> for ChunkedEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<ChunkedArray> for ChunkedEncoding
§fn accept(
&self,
array: &ChunkedArray,
visitor: &mut dyn ArrayVisitor,
@@ -98,9 +98,9 @@
F: FnOnce(&Self) -> bool,
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read moresource§impl<E> MetadataVTable for Ewhere
+otherwise. Read more
§impl<E> MetadataVTable for E
source§fn load_metadata(
+ <E as Encoding>::Metadata: for<'m> TryDeserializeArrayMetadata<'m>,
§fn load_metadata(
&self,
metadata: Option<&[u8]>,
) -> Result<Arc<dyn ArrayMetadata>, VortexError>
source§impl<T, U> TryFrom<U> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.ChunkedMetadata.html b/docs/rust/doc/vortex/array/struct.ChunkedMetadata.html
index c2af46fe9a..ddca7eca76 100644
--- a/docs/rust/doc/vortex/array/struct.ChunkedMetadata.html
+++ b/docs/rust/doc/vortex/array/struct.ChunkedMetadata.html
@@ -1,8 +1,8 @@
-ChunkedMetadata in vortex::array - Rust Struct vortex::array::ChunkedMetadata
source · pub struct ChunkedMetadata { /* private fields */ }
Trait Implementations§
source§impl ArrayMetadata for ChunkedMetadata
Implement ArrayMetadata
-source§impl Clone for ChunkedMetadata
source§fn clone(&self) -> ChunkedMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moresource§impl Debug for ChunkedMetadata
source§impl<'de> Deserialize<'de> for ChunkedMetadata
source§fn deserialize<__D>(
+ChunkedMetadata in vortex::array - Rust Struct vortex::array::ChunkedMetadata
pub struct ChunkedMetadata { /* private fields */ }
Trait Implementations§
§impl ArrayMetadata for ChunkedMetadata
Implement ArrayMetadata
+§impl Clone for ChunkedMetadata
§fn clone(&self) -> ChunkedMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl Debug for ChunkedMetadata
§impl<'de> Deserialize<'de> for ChunkedMetadata
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChunkedMetadata, <__D as Deserializer<'de>>::Error>where
- __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read moresource§impl Display for ChunkedMetadata
source§impl Serialize for ChunkedMetadata
source§fn serialize<__S>(
+ __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more§impl Display for ChunkedMetadata
§impl Serialize for ChunkedMetadata
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
@@ -27,13 +27,13 @@
otherwise. Read more
source§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
- M: Deserialize<'de>,
source§fn try_deserialize_metadata(
+ T: Display + ?Sized,
§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
+ M: Deserialize<'de>,
§fn try_deserialize_metadata(
metadata: Option<&'de [u8]>,
) -> Result<M, VortexError>
source§impl<M> TrySerializeArrayMetadata for Mwhere
- M: Serialize,
§impl<M> TrySerializeArrayMetadata for Mwhere
+ M: Serialize,
§fn try_serialize_metadata(&self) -> Result<Arc<[u8]>, VortexError>
§impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
diff --git a/docs/rust/doc/vortex/array/struct.ConstantArray.html b/docs/rust/doc/vortex/array/struct.ConstantArray.html
index 9c56726f53..1727911a05 100644
--- a/docs/rust/doc/vortex/array/struct.ConstantArray.html
+++ b/docs/rust/doc/vortex/array/struct.ConstantArray.html
@@ -1,98 +1,98 @@
-ConstantArray in vortex::array - Rust Struct vortex::array::ConstantArray
source · pub struct ConstantArray(/* private fields */);
Implementations§
source§impl ConstantArray
sourcepub fn maybe_from(data: ArrayData) -> Option<ConstantArray>
Optionally downcast an ArrayData
instance to a specific encoding.
+ConstantArray in vortex::array - Rust Struct vortex::array::ConstantArray
pub struct ConstantArray(/* private fields */);
Implementations§
§impl ConstantArray
pub fn maybe_from(data: ArrayData) -> Option<ConstantArray>
Optionally downcast an ArrayData
instance to a specific encoding.
Preferred in cases where a backtrace isn’t needed, like when trying multiple encoding to go
down different code paths.
-Trait Implementations§
source§impl<T> Accessor<T> for ConstantArray
source§impl AsRef<ArrayData> for ConstantArray
source§impl BinaryBooleanFn<ConstantArray> for ConstantEncoding
source§fn binary_boolean(
+
§impl ConstantArray
pub fn new<S>(scalar: S, length: usize) -> ConstantArraywhere
+ S: Into<Scalar>,
pub fn scalar(&self) -> Scalar
Returns the [Scalar
] value of this constant array.
+Trait Implementations§
§impl<T> Accessor<T> for ConstantArray
§impl AsRef<ArrayData> for ConstantArray
§impl BinaryBooleanFn<ConstantArray> for ConstantEncoding
§fn binary_boolean(
&self,
lhs: &ConstantArray,
rhs: &ArrayData,
op: BinaryOperator,
-) -> Result<Option<ArrayData>, VortexError>
source§impl Clone for ConstantArray
source§fn clone(&self) -> ConstantArray
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moresource§impl CompareFn<ConstantArray> for ConstantEncoding
§impl Clone for ConstantArray
§fn clone(&self) -> ConstantArray
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl CompareFn<ConstantArray> for ConstantEncoding
source§impl Debug for ConstantArray
source§impl ExtensionArrayTrait for ConstantArray
source§impl FilterFn<ConstantArray> for ConstantEncoding
§impl Debug for ConstantArray
§impl ExtensionArrayTrait for ConstantArray
§impl FilterFn<ConstantArray> for ConstantEncoding
§fn filter(
&self,
array: &ConstantArray,
mask: FilterMask,
-) -> Result<ArrayData, VortexError>
Filter an array by the provided predicate.source§impl IntoArrayData for ConstantArray
source§fn into_array(self) -> ArrayData
source§impl IntoCanonical for ConstantArray
source§impl InvertFn<ConstantArray> for ConstantEncoding
source§impl PrimitiveArrayTrait for ConstantArray
source§impl ScalarAtFn<ConstantArray> for ConstantEncoding
§impl IntoArrayData for ConstantArray
§fn into_array(self) -> ArrayData
§impl IntoCanonical for ConstantArray
§fn into_canonical(self) -> Result<Canonical, VortexError>
§fn into_arrow(self) -> Result<Arc<dyn Array>, VortexError>where
+ Self: Sized,
§impl InvertFn<ConstantArray> for ConstantEncoding
§fn invert(&self, array: &ConstantArray) -> Result<ArrayData, VortexError>
Logically invert a boolean array. Converts true -> false, false -> true, null -> null.§impl PrimitiveArrayTrait for ConstantArray
§impl ScalarAtFn<ConstantArray> for ConstantEncoding
source§impl SearchSortedFn<ConstantArray> for ConstantEncoding
source§fn search_sorted(
+) -> Result<Scalar, VortexError>
§impl SearchSortedFn<ConstantArray> for ConstantEncoding
§fn search_sorted(
&self,
array: &ConstantArray,
- value: &Scalar,
+ value: &Scalar,
side: SearchSortedSide,
-) -> Result<SearchResult, VortexError>
source§fn search_sorted_many(
+) -> Result<SearchResult, VortexError>
§fn search_sorted_many(
&self,
array: &Array,
- values: &[Scalar],
+ values: &[Scalar],
side: SearchSortedSide,
-) -> Result<Vec<SearchResult>, VortexError>
Bulk search for many values.
source§impl SliceFn<ConstantArray> for ConstantEncoding
§impl SliceFn<ConstantArray> for ConstantEncoding
§fn slice(
&self,
array: &ConstantArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<ConstantArray> for ConstantEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<ConstantArray> for ConstantEncoding
§fn compute_statistics(
&self,
array: &ConstantArray,
_stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl StructArrayTrait for ConstantArray
source§impl TakeFn<ConstantArray> for ConstantEncoding
§impl StructArrayTrait for ConstantArray
§impl TakeFn<ConstantArray> for ConstantEncoding
source§impl<'a> TryFrom<&'a ArrayData> for &'a ConstantArray
source§impl TryFrom<ArrayData> for ConstantArray
source§impl ValidityVTable<ConstantArray> for ConstantEncoding
source§fn is_valid(&self, array: &ConstantArray, _index: usize) -> bool
source§fn logical_validity(&self, array: &ConstantArray) -> LogicalValidity
source§impl VariantsVTable<ConstantArray> for ConstantEncoding
Constant arrays support all DTypes
-source§fn as_null_array<'a>(
+given indices
. Read more
§impl<'a> TryFrom<&'a ArrayData> for &'a ConstantArray
§impl TryFrom<ArrayData> for ConstantArray
§impl ValidityVTable<ConstantArray> for ConstantEncoding
§fn is_valid(&self, array: &ConstantArray, _index: usize) -> bool
§fn logical_validity(&self, array: &ConstantArray) -> LogicalValidity
§impl VariantsVTable<ConstantArray> for ConstantEncoding
Constant arrays support all DTypes
+§fn as_null_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn NullArrayTrait>
source§fn as_bool_array<'a>(
+) -> Option<&'a dyn NullArrayTrait>
§fn as_bool_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_primitive_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<ConstantArray> for ConstantEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<ConstantArray> for ConstantEncoding
§fn accept(
&self,
_array: &ConstantArray,
_visitor: &mut dyn ArrayVisitor,
-) -> Result<(), VortexError>
source§impl ArrayTrait for ConstantArray
source§impl BinaryArrayTrait for ConstantArray
source§impl BoolArrayTrait for ConstantArray
source§impl ListArrayTrait for ConstantArray
source§impl NullArrayTrait for ConstantArray
source§impl Utf8ArrayTrait for ConstantArray
Auto Trait Implementations§
§impl !Freeze for ConstantArray
§impl !RefUnwindSafe for ConstantArray
§impl Send for ConstantArray
§impl Sync for ConstantArray
§impl Unpin for ConstantArray
§impl !UnwindSafe for ConstantArray
Blanket Implementations§
source§impl<T> ArrayEncodingRef for T
source§fn encoding(&self) -> &'static dyn EncodingVTable
source§impl<A> ArrayNBytes for A
source§impl<T> ArrayStatistics for T
source§fn statistics(&self) -> &dyn Statistics
source§fn inherit_statistics(&self, parent: &dyn Statistics)
source§impl<A> ArrayValidity for A
source§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
-source§fn logical_validity(&self) -> LogicalValidity
§impl ArrayTrait for ConstantArray
§impl BinaryArrayTrait for ConstantArray
§impl BoolArrayTrait for ConstantArray
§impl ListArrayTrait for ConstantArray
§impl NullArrayTrait for ConstantArray
§impl Utf8ArrayTrait for ConstantArray
Auto Trait Implementations§
§impl !Freeze for ConstantArray
§impl !RefUnwindSafe for ConstantArray
§impl Send for ConstantArray
§impl Sync for ConstantArray
§impl Unpin for ConstantArray
§impl !UnwindSafe for ConstantArray
Blanket Implementations§
§impl<T> ArrayEncodingRef for T
§fn encoding(&self) -> &'static dyn EncodingVTable
§impl<A> ArrayNBytes for A
§impl<T> ArrayStatistics for T
§fn statistics(&self) -> &dyn Statistics
§fn inherit_statistics(&self, parent: &dyn Statistics)
§impl<A> ArrayValidity for A
§fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
+§fn logical_validity(&self) -> LogicalValidity
Return the logical validity of the array.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moresource§impl<T> CloneToUninit for Twhere
@@ -103,16 +103,16 @@
U: From<T>,
source§impl<T> IntoArrayVariant for Twhere
- T: IntoCanonical,
source§fn into_null(self) -> Result<NullArray, VortexError>
source§fn into_bool(self) -> Result<BoolArray, VortexError>
source§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
source§fn into_struct(self) -> Result<StructArray, VortexError>
source§fn into_list(self) -> Result<ListArray, VortexError>
source§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
source§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
§impl<T> IntoArrayVariant for Twhere
+ T: IntoCanonical,
§fn into_null(self) -> Result<NullArray, VortexError>
§fn into_bool(self) -> Result<BoolArray, VortexError>
§fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
§fn into_struct(self) -> Result<StructArray, VortexError>
§fn into_list(self) -> Result<ListArray, VortexError>
§fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
§fn into_extension(self) -> Result<ExtensionArray, VortexError>
source§impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read more§impl<V, T> VZip<V> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.ConstantEncoding.html b/docs/rust/doc/vortex/array/struct.ConstantEncoding.html
index 4de2c95785..44551c4566 100644
--- a/docs/rust/doc/vortex/array/struct.ConstantEncoding.html
+++ b/docs/rust/doc/vortex/array/struct.ConstantEncoding.html
@@ -1,81 +1,81 @@
-ConstantEncoding in vortex::array - Rust Struct vortex::array::ConstantEncoding
source · pub struct ConstantEncoding;
Expand description
The array encoding
-Trait Implementations§
source§impl BinaryBooleanFn<ConstantArray> for ConstantEncoding
source§fn binary_boolean(
+ConstantEncoding in vortex::array - Rust Struct vortex::array::ConstantEncoding
pub struct ConstantEncoding;
Expand description
The array encoding
+Trait Implementations§
§impl BinaryBooleanFn<ConstantArray> for ConstantEncoding
§fn binary_boolean(
&self,
lhs: &ConstantArray,
rhs: &ArrayData,
op: BinaryOperator,
-) -> Result<Option<ArrayData>, VortexError>
source§impl CompareFn<ConstantArray> for ConstantEncoding
§impl CompareFn<ConstantArray> for ConstantEncoding
source§impl ComputeVTable for ConstantEncoding
source§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read moresource§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read moresource§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read moresource§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read moresource§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read moresource§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read moresource§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read moresource§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
-the receiver. Read moresource§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read moresource§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read moresource§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read moresource§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read moresource§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read moresource§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read moresource§impl Debug for ConstantEncoding
source§impl Encoding for ConstantEncoding
source§const ID: EncodingId = _
source§type Array = ConstantArray
source§type Metadata = ConstantMetadata
source§impl EncodingVTable for ConstantEncoding
source§impl FilterFn<ConstantArray> for ConstantEncoding
§impl ComputeVTable for ConstantEncoding
§fn binary_boolean_fn(&self) -> Option<&dyn BinaryBooleanFn<ArrayData>>
Implementation of binary boolean logic operations. Read more§fn compare_fn(&self) -> Option<&dyn CompareFn<ArrayData>>
Binary operator implementation for arrays against other arrays. Read more§fn filter_fn(&self) -> Option<&dyn FilterFn<ArrayData>>
Filter an array with a given mask. Read more§fn invert_fn(&self) -> Option<&dyn InvertFn<ArrayData>>
Invert a boolean array. Converts true -> false, false -> true, null -> null. Read more§fn scalar_at_fn(&self) -> Option<&dyn ScalarAtFn<ArrayData>>
Single item indexing on Vortex arrays. Read more§fn search_sorted_fn(&self) -> Option<&dyn SearchSortedFn<ArrayData>>
Perform a search over an ordered array. Read more§fn slice_fn(&self) -> Option<&dyn SliceFn<ArrayData>>
Perform zero-copy slicing of an array. Read more§fn take_fn(&self) -> Option<&dyn TakeFn<ArrayData>>
Take a set of indices from an array. This often forces allocations and decoding of
+the receiver. Read more§fn cast_fn(&self) -> Option<&dyn CastFn<ArrayData>>
Implemented for arrays that can be casted to different types. Read more§fn fill_forward_fn(&self) -> Option<&dyn FillForwardFn<ArrayData>>
Array function that returns new arrays a non-null value is repeated across runs of nulls. Read more§fn fill_null_fn(&self) -> Option<&dyn FillNullFn<ArrayData>>
Fill null values with given desired value. Resulting array is NonNullable Read more§fn like_fn(&self) -> Option<&dyn LikeFn<ArrayData>>
Perform a SQL LIKE operation on two arrays. Read more§fn search_sorted_usize_fn(&self) -> Option<&dyn SearchSortedUsizeFn<ArrayData>>
Perform a search over an ordered array. Read more§fn subtract_scalar_fn(&self) -> Option<&dyn SubtractScalarFn<ArrayData>>
Broadcast subtraction of scalar from Vortex array. Read more§impl Debug for ConstantEncoding
§impl Encoding for ConstantEncoding
§impl EncodingVTable for ConstantEncoding
§impl FilterFn<ConstantArray> for ConstantEncoding
§fn filter(
&self,
array: &ConstantArray,
mask: FilterMask,
-) -> Result<ArrayData, VortexError>
Filter an array by the provided predicate.source§impl InvertFn<ConstantArray> for ConstantEncoding
source§impl ScalarAtFn<ConstantArray> for ConstantEncoding
§impl InvertFn<ConstantArray> for ConstantEncoding
§fn invert(&self, array: &ConstantArray) -> Result<ArrayData, VortexError>
Logically invert a boolean array. Converts true -> false, false -> true, null -> null.§impl ScalarAtFn<ConstantArray> for ConstantEncoding
source§impl SearchSortedFn<ConstantArray> for ConstantEncoding
source§fn search_sorted(
+) -> Result<Scalar, VortexError>
§impl SearchSortedFn<ConstantArray> for ConstantEncoding
§fn search_sorted(
&self,
array: &ConstantArray,
- value: &Scalar,
+ value: &Scalar,
side: SearchSortedSide,
-) -> Result<SearchResult, VortexError>
source§fn search_sorted_many(
+) -> Result<SearchResult, VortexError>
§fn search_sorted_many(
&self,
array: &Array,
- values: &[Scalar],
+ values: &[Scalar],
side: SearchSortedSide,
-) -> Result<Vec<SearchResult>, VortexError>
Bulk search for many values.
source§impl SliceFn<ConstantArray> for ConstantEncoding
§impl SliceFn<ConstantArray> for ConstantEncoding
§fn slice(
&self,
array: &ConstantArray,
start: usize,
stop: usize,
) -> Result<ArrayData, VortexError>
Return a zero-copy slice of an array, between start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
-Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<ConstantArray> for ConstantEncoding
source§fn compute_statistics(
+Assumes that start or stop are out of bounds, may panic otherwise.
§impl StatisticsVTable<ConstantArray> for ConstantEncoding
§fn compute_statistics(
&self,
array: &ConstantArray,
_stat: Stat,
-) -> Result<StatsSet, VortexError>
Compute the requested statistic. Can return additional stats.source§impl TakeFn<ConstantArray> for ConstantEncoding
§impl TakeFn<ConstantArray> for ConstantEncoding
source§impl ValidityVTable<ConstantArray> for ConstantEncoding
source§fn is_valid(&self, array: &ConstantArray, _index: usize) -> bool
source§fn logical_validity(&self, array: &ConstantArray) -> LogicalValidity
source§impl VariantsVTable<ConstantArray> for ConstantEncoding
Constant arrays support all DTypes
-source§fn as_null_array<'a>(
+given indices
. Read more
§impl ValidityVTable<ConstantArray> for ConstantEncoding
§fn is_valid(&self, array: &ConstantArray, _index: usize) -> bool
§fn logical_validity(&self, array: &ConstantArray) -> LogicalValidity
§impl VariantsVTable<ConstantArray> for ConstantEncoding
Constant arrays support all DTypes
+§fn as_null_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn NullArrayTrait>
source§fn as_bool_array<'a>(
+) -> Option<&'a dyn NullArrayTrait>
§fn as_bool_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn BoolArrayTrait>
source§fn as_primitive_array<'a>(
+) -> Option<&'a dyn BoolArrayTrait>
§fn as_primitive_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn PrimitiveArrayTrait>
source§fn as_utf8_array<'a>(
+) -> Option<&'a dyn PrimitiveArrayTrait>
§fn as_utf8_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn Utf8ArrayTrait>
source§fn as_binary_array<'a>(
+) -> Option<&'a dyn Utf8ArrayTrait>
§fn as_binary_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn BinaryArrayTrait>
source§fn as_struct_array<'a>(
+) -> Option<&'a dyn BinaryArrayTrait>
§fn as_struct_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn StructArrayTrait>
source§fn as_list_array<'a>(
+) -> Option<&'a dyn StructArrayTrait>
§fn as_list_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn ListArrayTrait>
source§fn as_extension_array<'a>(
+) -> Option<&'a dyn ListArrayTrait>
§fn as_extension_array<'a>(
&self,
array: &'a ConstantArray,
-) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<ConstantArray> for ConstantEncoding
source§fn accept(
+) -> Option<&'a dyn ExtensionArrayTrait>
§impl VisitorVTable<ConstantArray> for ConstantEncoding
§fn accept(
&self,
_array: &ConstantArray,
_visitor: &mut dyn ArrayVisitor,
@@ -96,9 +96,9 @@
F: FnOnce(&Self) -> bool,
Converts self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
-otherwise. Read moresource§impl<E> MetadataVTable for Ewhere
+otherwise. Read more
§impl<E> MetadataVTable for E
source§fn load_metadata(
+ <E as Encoding>::Metadata: for<'m> TryDeserializeArrayMetadata<'m>,
§fn load_metadata(
&self,
metadata: Option<&[u8]>,
) -> Result<Arc<dyn ArrayMetadata>, VortexError>
source§impl<T, U> TryFrom<U> for Twhere
diff --git a/docs/rust/doc/vortex/array/struct.ConstantMetadata.html b/docs/rust/doc/vortex/array/struct.ConstantMetadata.html
index 0dea8b3802..e15a5db7e0 100644
--- a/docs/rust/doc/vortex/array/struct.ConstantMetadata.html
+++ b/docs/rust/doc/vortex/array/struct.ConstantMetadata.html
@@ -1,8 +1,8 @@
-ConstantMetadata in vortex::array - Rust Struct vortex::array::ConstantMetadata
source · pub struct ConstantMetadata { /* private fields */ }
Trait Implementations§
source§impl ArrayMetadata for ConstantMetadata
Implement ArrayMetadata
-source§impl Clone for ConstantMetadata
source§fn clone(&self) -> ConstantMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moresource§impl Debug for ConstantMetadata
source§impl<'de> Deserialize<'de> for ConstantMetadata
source§fn deserialize<__D>(
+ConstantMetadata in vortex::array - Rust Struct vortex::array::ConstantMetadata
pub struct ConstantMetadata { /* private fields */ }
Trait Implementations§
§impl ArrayMetadata for ConstantMetadata
Implement ArrayMetadata
+§impl Clone for ConstantMetadata
§fn clone(&self) -> ConstantMetadata
Returns a copy of the value. Read more1.0.0 · source§fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more§impl Debug for ConstantMetadata
§impl<'de> Deserialize<'de> for ConstantMetadata
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConstantMetadata, <__D as Deserializer<'de>>::Error>where
- __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read moresource§impl Display for ConstantMetadata
source§impl Serialize for ConstantMetadata
source§fn serialize<__S>(
+ __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more§impl Display for ConstantMetadata
§impl Serialize for ConstantMetadata
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
@@ -27,13 +27,13 @@
otherwise. Read more
source§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
- M: Deserialize<'de>,
source§fn try_deserialize_metadata(
+ T: Display + ?Sized,
§impl<'de, M> TryDeserializeArrayMetadata<'de> for Mwhere
+ M: Deserialize<'de>,
§fn try_deserialize_metadata(
metadata: Option<&'de [u8]>,
) -> Result<M, VortexError>
source§impl<M> TrySerializeArrayMetadata for Mwhere
- M: Serialize,
§impl<M> TrySerializeArrayMetadata for Mwhere
+ M: Serialize,
§fn try_serialize_metadata(&self) -> Result<Arc<[u8]>, VortexError>
§impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
diff --git a/docs/rust/doc/vortex/array/struct.ExtensionArray.html b/docs/rust/doc/vortex/array/struct.ExtensionArray.html
index 11df2350de..38c763b9df 100644
--- a/docs/rust/doc/vortex/array/struct.ExtensionArray.html
+++ b/docs/rust/doc/vortex/array/struct.ExtensionArray.html
@@ -1,65 +1,65 @@
-ExtensionArray in vortex::array - Rust Struct vortex::array::ExtensionArray
source · pub struct ExtensionArray(/* private fields */);
Implementations§
source§impl ExtensionArray
sourcepub fn maybe_from(data: ArrayData) -> Option<ExtensionArray>
Optionally downcast an ArrayData
instance to a specific encoding.
+ExtensionArray in vortex::array - Rust