Skip to main content

Interrupt

Struct Interrupt 

Source
pub struct Interrupt(/* private fields */);
Expand description

A handle on a running statement.

Cloning is cloning the handle, not the state: every clone reads and writes the same word, which is what lets one thread hand a copy to the executor and keep one to raise. Interrupt::default is the handle nobody is holding, and it is the one that costs nothing.

Implementations§

Source§

impl Interrupt

Source

pub fn armed() -> Interrupt

A handle a caller can raise, with the word allocated for it.

Spelled apart from Default because the two are different things: this one can stop a statement and the default one cannot, and a constructor that quietly returned the second when asked for the first would be a cancellation that never arrives.

Source

pub fn stop(&self)

Asks the statement to stop. Does nothing on a handle nobody armed, which is the honest answer: there is no statement on the other end of it.

Source

pub fn stopped(&self) -> bool

Whether somebody has asked.

Source

pub fn check(&self) -> Result<()>

The check an executor makes at a boundary: Ok while nobody has asked, and the condition that ends the statement once somebody has.

Source

pub fn clear(&self)

Puts the flag down and the count back to zero, which is what makes one handle serve a session rather than one statement.

Called before a statement rather than after it, so that a stop which arrived while nothing was running cannot end the next thing the user types.

Source

pub fn read(&self, rows: u64)

The executor reporting rows it has read out of storage.

Rows read rather than rows answered, because the number is there to show a person that something is happening, and a statement that reads a hundred million rows to answer one row is exactly the statement they are waiting on.

Source

pub fn rows(&self) -> u64

How many rows it has read so far.

Trait Implementations§

Source§

impl Clone for Interrupt

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interrupt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Interrupt

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.