[−][src]Struct tarantool_module::sequence::Sequence
A sequence is a generator of ordered integer values.
Implementations
impl Sequence
[src]
pub fn find(name: &str) -> Result<Option<Self>, Error>
[src]
Find sequence by name.
pub fn next(&mut self) -> Result<i64, Error>
[src]
Generate the next value and return it.
The generation algorithm is simple:
- If this is the first time, then return the
start
value. - If the previous value plus the
increment
value is less than theminimum
value or greater than themaximum
value, that is "overflow", so either raise an error (ifcycle = false
) or return themaximum
value (ifcycle = true
andstep < 0
) or return theminimum
value (ifcycle = true
andstep > 0
).
If there was no error, then save the returned result, it is now the "previous value".
pub fn set(&mut self, new_value: i64) -> Result<(), Error>
[src]
Set the "previous value" to new_value
.
This function requires a "write" privilege on the sequence.
pub fn reset(&mut self) -> Result<(), Error>
[src]
Set the sequence back to its original state.
The effect is that a subsequent next will return the start value. This function requires a "write" privilege on the sequence.
Auto Trait Implementations
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnwindSafe for Sequence
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,