pub struct CstrRequireOperation<'c> { /* private fields */ }
Expand description
A cstr_require
operation. Represents a runtime assertion that an i1 is true
.
Represents a runtime assertion that an i1 is true. It returns a !shape.witness to order this assertion.
For simplicity, prefer using other cstr_* ops if they are available for a given constraint.
Example:
%bool = ...
%w0 = shape.cstr_require %bool, "msg" // Passing if `%bool` is true.
Since this op can be used to express many different possible assertions
(depending on whatever computation calculated pred
), the msg
should clarify the nature of the assertion for users.
Implementations§
source§impl<'c> CstrRequireOperation<'c>
impl<'c> CstrRequireOperation<'c>
sourcepub fn as_operation(&self) -> &Operation<'c>
pub fn as_operation(&self) -> &Operation<'c>
Returns a generic operation.
sourcepub fn builder(
context: &'c Context,
location: Location<'c>
) -> CstrRequireOperationBuilder<'c, Unset, Unset, Unset>
pub fn builder( context: &'c Context, location: Location<'c> ) -> CstrRequireOperationBuilder<'c, Unset, Unset, Unset>
Creates a builder.
pub fn result(&self) -> Result<OperationResult<'c, '_>, Error>
pub fn pred(&self) -> Result<Value<'c, '_>, Error>
pub fn msg(&self) -> Result<StringAttribute<'c>, Error>
pub fn set_msg(&mut self, value: StringAttribute<'c>)
Trait Implementations§
source§impl<'c> From<CstrRequireOperation<'c>> for Operation<'c>
impl<'c> From<CstrRequireOperation<'c>> for Operation<'c>
source§fn from(operation: CstrRequireOperation<'c>) -> Self
fn from(operation: CstrRequireOperation<'c>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'c> RefUnwindSafe for CstrRequireOperation<'c>
impl<'c> !Send for CstrRequireOperation<'c>
impl<'c> !Sync for CstrRequireOperation<'c>
impl<'c> Unpin for CstrRequireOperation<'c>
impl<'c> UnwindSafe for CstrRequireOperation<'c>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more