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 Eq for Abort
impl StructuralEq for Abort
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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