/// Allows iteration over a set of key/value pairs, either forwards or backwards.
///
/// The bound `start` is inclusive and `end` is exclusive.
///
/// If `start` is lexicographically greater than or equal to `end`, an empty range is described, mo matter of the order.
Allows iteration over a set of key/value pairs, either forwards or backwards.
The bound `start` is inclusive and `end` is exclusive.

If `start` is lexicographically greater than or equal to `end`, an empty range is described, mo matter of the order.
Allows iteration over a set of key / value pairs either forwards or backwards . The bound ` start ` is inclusive and ` end ` is exclusive . If ` start ` is lexicographically greater than or equal to ` end ` an empty range is described mo matter of the order .
fn range<'a>(
        &'a self,
        start: Option<&[u8]>,
        end: Option<&[u8]>,
        order: cosmwasm_std::Order,
    ) -> FfiResult<Box<dyn StorageIterator + 'a>> {
        // returns nul pointer in Buffer in none, otherwise proper buffer
        let start_buf = start
            .map(|s| Buffer::from_vec(s.to_vec()))
            .unwrap_or_default();
        let end_buf = end
            .map(|e| Buffer::from_vec(e.to_vec()))
            .unwrap_or_default();
        let mut err = Buffer::default();
        let mut iter = GoIter::new(self.gas_meter);
        let mut used_gas = 0_u64;
        let go_result: GoResult = (self.vtable.scan_db)(
            self.state,
            self.gas_meter,
            &mut used_gas as *mut u64,
            start_buf,
            end_buf,
            order.into(),
            &mut iter as *mut GoIter,
            &mut err as *mut Buffer,
        )
        .into();
        let gas_info = GasInfo::with_externally_used(used_gas);
        let _start = unsafe { start_buf.consume() };
        let _end = unsafe { end_buf.consume() };
        // return complete error message (reading from buffer for GoResult::Other)
        let default = || {
            format!(
                "Failed to read the next key between {:?} and {:?}",
                start.map(String::from_utf8_lossy),
                end.map(String::from_utf8_lossy),
            )
        };
        unsafe {
            if let Err(err) = go_result.into_ffi_result(err, default) {
                return (Err(err), gas_info);
            }
        }
        (Ok(Box::new(iter)), gas_info)
    }
fn range < ' a > ( & ' a self , start : Option < & [ u8 ] > , end : Option < & [ u8 ] > , order : cosmwasm_std :: Order , ) -> FfiResult < Box < dyn StorageIterator + ' a > > { // returns nul pointer in Buffer in none, otherwise proper buffer let start_buf = start . map ( | s | Buffer :: from_vec ( s . to_vec ( ) ) ) . unwrap_or_default ( ) ; let end_buf = end . map ( | e | Buffer :: from_vec ( e . to_vec ( ) ) ) . unwrap_or_default ( ) ; let mut err = Buffer :: default ( ) ; let mut iter = GoIter :: new ( self . gas_meter ) ; let mut used_gas = 0_u64 ; let go_result : GoResult = ( self . vtable . scan_db ) ( self . state , self . gas_meter , & mut used_gas as * mut u64 , start_buf , end_buf , order . into ( ) , & mut iter as * mut GoIter , & mut err as * mut Buffer , ) . into ( ) ; let gas_info = GasInfo :: with_externally_used ( used_gas ) ; let _start = unsafe { start_buf . consume ( ) } ; let _end = unsafe { end_buf . consume ( ) } ; // return complete error message (reading from buffer for GoResult::Other) let default = | | { format ! ( " " start map ( String from_utf8_lossy ) end map ( String from_utf8_lossy ) ) } ; unsafe { if let Err ( err ) = go_result . into_ffi_result ( err , default ) { return ( Err ( err ) , gas_info ) ; } } ( Ok ( Box :: new ( iter ) ) , gas_info ) }
Allows iteration over a set of key/value pairs, either forwards or backwards.
Allows iteration over a set of key / value pairs either forwards or backwards .
&'a self
start
Option<&[u8]>
end
Option<&[u8]>
order
cosmwasm_std::Order