pub struct TpToken(/* private fields */);
Expand description
A transaction processing token, used by yottadb to ensure ACID properties.
The only valid values for a TpToken are the default (TpToken::default()
)
or a token passed in from Context::tp
.
TpTokens can be converted to u64
, but not vice-versa.
Trait Implementations§
source§impl From<TpToken> for u64
impl From<TpToken> for u64
source§fn from(tptoken: TpToken) -> u64
fn from(tptoken: TpToken) -> u64
This is useful for calling C functions that have not yet been wrapped in the simple_api
from inside a transaction.
§Example
use yottadb::*;
use yottadb::craw::ydb_buffer_t;
Context::new().tp(|ctx| {
let tptoken_raw = u64::from(ctx.tptoken());
let mut errstr = ydb_buffer_t {
buf_addr: std::ptr::null_mut(),
len_alloc: 0,
len_used: 0,
};
unsafe { craw::ydb_stdout_stderr_adjust_t(tptoken_raw, &mut errstr) };
Ok(TransactionStatus::Ok)
}, "BATCH", &[]);
source§impl PartialEq for TpToken
impl PartialEq for TpToken
impl Copy for TpToken
impl Eq for TpToken
impl StructuralPartialEq for TpToken
Auto Trait Implementations§
impl RefUnwindSafe for TpToken
impl Send for TpToken
impl Sync for TpToken
impl Unpin for TpToken
impl UnwindSafe for TpToken
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