pub struct Instance {
pub light_client: LightClient,
pub state: State,
}Expand description
A light client Instance packages a LightClient together with its State.
Fields§
§light_client: LightClientThe light client for this instance
state: StateThe state of the light client for this instance
Implementations§
Source§impl Instance
impl Instance
Sourcepub fn new(light_client: LightClient, state: State) -> Self
pub fn new(light_client: LightClient, state: State) -> Self
Constructs a new instance from the given light client and its state.
Sourcepub fn latest_trusted(&self) -> Option<LightBlock>
pub fn latest_trusted(&self) -> Option<LightBlock>
Get the latest trusted block.
Sourcepub fn trust_block(&mut self, lb: &LightBlock)
pub fn trust_block(&mut self, lb: &LightBlock)
Trust the given block.
Sourcepub fn get_or_fetch_block(
&mut self,
height: Height,
) -> Result<LightBlock, Error>
pub fn get_or_fetch_block( &mut self, height: Height, ) -> Result<LightBlock, Error>
Get or fetch the block at the given height
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Instance
impl !RefUnwindSafe for Instance
impl Send for Instance
impl Sync for Instance
impl Unpin for Instance
impl !UnwindSafe for Instance
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