Skip to main content

SliceIndexSpecImpl

Trait SliceIndexSpecImpl 

Source
pub trait SliceIndexSpecImpl<T>: SliceIndex<T>
where T: ?Sized,
{ // Required methods exec fn in_bounds(&self, slice: &T) -> bool; exec fn index_postcondition(&self, slice: &T, r: &Self::Output) -> bool; exec fn index_mut_postcondition( &self, old_slice: &T, final_slice: &T, immediate_output: &Self::Output, final_output: &Self::Output, ) -> bool; }

Required Methods§

Source

exec fn in_bounds(&self, slice: &T) -> bool

Source

exec fn index_postcondition(&self, slice: &T, r: &Self::Output) -> bool

Source

exec fn index_mut_postcondition( &self, old_slice: &T, final_slice: &T, immediate_output: &Self::Output, final_output: &Self::Output, ) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SliceIndexSpecImpl<str> for (Bound<usize>, Bound<usize>)

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for Range<usize>

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for RangeFrom<usize>

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for RangeFull

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for RangeInclusive<usize>

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for RangeTo<usize>

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl SliceIndexSpecImpl<str> for RangeToInclusive<usize>

Available on verus_keep_ghost and non-verus_verify_core only.
Source§

open spec fn in_bounds(&self, s: &str) -> bool

{ str_slice_in_bounds(self, s) }
Source§

open spec fn index_postcondition(&self, s: &str, r: &str) -> bool

{ str_slice_index_postcondition(self, s.spec_bytes(), r.spec_bytes()) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &str, final_slice: &str, immediate_output: &str, final_output: &str, ) -> bool

{
    str_slice_index_mut_postcondition(
        self,
        old_slice.spec_bytes(),
        final_slice.spec_bytes(),
        immediate_output.spec_bytes(),
        final_output.spec_bytes(),
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for Range<usize>

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for RangeFrom<usize>

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for RangeFull

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for RangeInclusive<usize>

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for RangeTo<usize>

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for RangeToInclusive<usize>

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ generic_slice_in_bounds(self, slice@) }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &[T]) -> bool

{ generic_slice_index_postcondition(self, slice@, r@) }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &[T], final_output: &[T], ) -> bool

{
    generic_slice_index_mut_postcondition(
        self,
        old_slice@,
        final_slice@,
        immediate_output@,
        final_output@,
    )
}
Source§

impl<T> SliceIndexSpecImpl<[T]> for usize

Source§

open spec fn in_bounds(&self, slice: &[T]) -> bool

{ *self < slice@.len() }
Source§

open spec fn index_postcondition(&self, slice: &[T], r: &T) -> bool

{ r == slice@[self as int] }
Source§

open spec fn index_mut_postcondition( &self, old_slice: &[T], final_slice: &[T], immediate_output: &T, final_output: &T, ) -> bool

{
    &&& *immediate_output == old_slice@[*self as int]
    &&& final_slice@ == old_slice@.update(*self as int, *final_output)

}

Implementors§