pub struct Inputs { /* private fields */ }Expand description
The verified inputs a macro phase may read.
Construction is the verification: an Inputs cannot hold bytes that do not
match their declared hash, because Inputs::bind is the only way in and it
checks. That is why the reading primitive has no error path for a bad hash —
the state is unrepresentable rather than guarded against.
Implementations§
Source§impl Inputs
impl Inputs
pub fn new() -> Self
Sourcepub fn bind(
&mut self,
decl: &Declaration,
bytes: Vec<u8>,
) -> Result<(), InputError>
pub fn bind( &mut self, decl: &Declaration, bytes: Vec<u8>, ) -> Result<(), InputError>
Bind bytes to a declaration, verifying the hash.
Refuses on mismatch. Accepting the bytes and warning would defeat the point: the declaration is a claim about which bytes, and honouring a different set makes the build irreproducible in exactly the way content addressing exists to prevent.
pub fn get(&self, name: &str) -> Option<&[u8]>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Inputs
impl RefUnwindSafe for Inputs
impl Send for Inputs
impl Sync for Inputs
impl Unpin for Inputs
impl UnsafeUnpin for Inputs
impl UnwindSafe for Inputs
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