Struct sway_core::error::CompileResult
source · pub struct CompileResult<T> {
pub value: Option<T>,
pub warnings: Vec<CompileWarning>,
pub errors: Vec<CompileError>,
}
Fields
value: Option<T>
warnings: Vec<CompileWarning>
errors: Vec<CompileError>
Implementations
sourceimpl<T> CompileResult<T>
impl<T> CompileResult<T>
pub fn is_ok(&self) -> bool
pub fn is_ok_no_warn(&self) -> bool
pub fn new(
value: Option<T>,
warnings: Vec<CompileWarning>,
errors: Vec<CompileError>
) -> Self
pub fn with_handler(
run: impl FnOnce(&Handler) -> Result<T, ErrorEmitted>
) -> CompileResult<T>
pub fn from_handler(value: Option<T>, handler: Handler) -> Self
pub fn ok(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>
) -> Option<T>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> CompileResult<U>
pub fn flat_map<U, F: FnOnce(T) -> CompileResult<U>>(
self,
f: F
) -> CompileResult<U>
pub fn unwrap(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>
) -> T
pub fn unwrap_or_else<F: FnOnce() -> T>(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>,
or_else: F
) -> T
sourceimpl<'a, T> CompileResult<&'a T>where
T: Clone,
impl<'a, T> CompileResult<&'a T>where
T: Clone,
sourcepub fn cloned(self) -> CompileResult<T>
pub fn cloned(self) -> CompileResult<T>
Converts a CompileResult
around a reference value to an owned value by cloning the type
behind the reference.
Trait Implementations
sourceimpl<T: Clone> Clone for CompileResult<T>
impl<T: Clone> Clone for CompileResult<T>
sourcefn clone(&self) -> CompileResult<T>
fn clone(&self) -> CompileResult<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<T: Debug> Debug for CompileResult<T>
impl<T: Debug> Debug for CompileResult<T>
sourceimpl<T> From<Result<T, CompileError>> for CompileResult<T>
impl<T> From<Result<T, CompileError>> for CompileResult<T>
sourcefn from(o: Result<T, CompileError>) -> Self
fn from(o: Result<T, CompileError>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<T> RefUnwindSafe for CompileResult<T>where
T: RefUnwindSafe,
impl<T> Send for CompileResult<T>where
T: Send,
impl<T> Sync for CompileResult<T>where
T: Sync,
impl<T> Unpin for CompileResult<T>where
T: Unpin,
impl<T> UnwindSafe for CompileResult<T>where
T: UnwindSafe,
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