pub struct StrVecBuilder<'a> {
vec: SEXP,
_scope: &'a ProtectScope,
}Expand description
Builder for constructing string vectors with efficient protection management.
§Example
ⓘ
unsafe fn build_strvec(strings: &[&str]) -> SEXP {
let scope = ProtectScope::new();
let builder = StrVecBuilder::new(&scope, strings.len() as isize);
for (i, s) in strings.iter().enumerate() {
builder.set_str(i as isize, s);
}
builder.into_sexp()
}Fields§
§vec: SEXP§_scope: &'a ProtectScopeImplementations§
Source§impl<'a> StrVecBuilder<'a>
impl<'a> StrVecBuilder<'a>
Sourcepub unsafe fn new(scope: &'a ProtectScope, len: usize) -> Self
pub unsafe fn new(scope: &'a ProtectScope, len: usize) -> Self
Create a new string vector builder with the given length.
§Safety
Must be called from the R main thread.
Sourcepub unsafe fn set_opt_str(&self, idx: isize, s: Option<&str>)
pub unsafe fn set_opt_str(&self, idx: isize, s: Option<&str>)
Sourcepub fn into_strvec(self) -> StrVec
pub fn into_strvec(self) -> StrVec
Convert to a StrVec wrapper.
Auto Trait Implementations§
impl<'a> Freeze for StrVecBuilder<'a>
impl<'a> !RefUnwindSafe for StrVecBuilder<'a>
impl<'a> !Send for StrVecBuilder<'a>
impl<'a> !Sync for StrVecBuilder<'a>
impl<'a> Unpin for StrVecBuilder<'a>
impl<'a> UnsafeUnpin for StrVecBuilder<'a>
impl<'a> !UnwindSafe for StrVecBuilder<'a>
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