pub struct Abort;
Expand description
A simple type used in conjunction with FunctionError representing that the function should abort without a custom message.
use near_sdk::borsh::{BorshDeserialize, BorshSerialize};
use near_sdk::{Abort, near_bindgen};
#[near_bindgen]
#[derive(Default, BorshDeserialize, BorshSerialize)]
pub struct Contract;
#[near_bindgen]
impl Contract {
#[handle_result]
pub fn foo(&self, text: &str) -> Result<String, Abort> {
if text == "success" {
Ok("success".to_string())
} else {
Err(Abort)
}
}
}
Trait Implementations
impl StructuralPartialEq for Abort
Auto Trait Implementations
impl RefUnwindSafe for Abort
impl Send for Abort
impl Sync for Abort
impl Unpin for Abort
impl UnwindSafe for Abort
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more