pub struct ArgBuilder { /* private fields */ }Expand description
A builder for constructing named kernel argument arrays.
Collects typed argument values along with their names, then
produces the Vec<*mut c_void> array needed by cuLaunchKernel.
§Example
use oxicuda_launch::named_args::ArgBuilder;
let x: f32 = 3.14;
let n: u32 = 512;
let mut builder = ArgBuilder::new();
builder.add("x", &x).add("n", &n);
assert_eq!(builder.arg_count(), 2);
let ptrs = builder.build();
assert_eq!(ptrs.len(), 2);Implementations§
Source§impl ArgBuilder
impl ArgBuilder
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new argument builder with the given initial capacity.
Sourcepub fn add<T: Copy>(&mut self, name: &str, val: &T) -> &mut Self
pub fn add<T: Copy>(&mut self, name: &str, val: &T) -> &mut Self
Adds a named argument to the builder.
The pointer to val is stored. The caller must ensure that val
remains valid (not moved or dropped) until the kernel launch
using the built pointer array completes.
Returns &mut Self for method chaining.
Trait Implementations§
Source§impl Debug for ArgBuilder
impl Debug for ArgBuilder
Auto Trait Implementations§
impl Freeze for ArgBuilder
impl RefUnwindSafe for ArgBuilder
impl !Send for ArgBuilder
impl !Sync for ArgBuilder
impl Unpin for ArgBuilder
impl UnsafeUnpin for ArgBuilder
impl UnwindSafe for ArgBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more