Trait java_string::JavaStrSliceIndex

source ·
pub unsafe trait JavaStrSliceIndex: Sealed + Sized {
    // Required methods
    fn check_bounds(&self, slice: &JavaStr) -> bool;
    fn check_bounds_fail(self, slice: &JavaStr) -> !;
    unsafe fn get_unchecked(self, slice: *const JavaStr) -> *const JavaStr;
    unsafe fn get_unchecked_mut(self, slice: *mut JavaStr) -> *mut JavaStr;

    // Provided methods
    fn get(self, slice: &JavaStr) -> Option<&JavaStr> { ... }
    fn get_mut(self, slice: &mut JavaStr) -> Option<&mut JavaStr> { ... }
    fn index(self, slice: &JavaStr) -> &JavaStr { ... }
    fn index_mut(self, slice: &mut JavaStr) -> &mut JavaStr { ... }
}
Expand description

§Safety

Implementations’ check_bounds method must properly check the bounds of the slice, such that calling get_unchecked is not UB.

Required Methods§

source

fn check_bounds(&self, slice: &JavaStr) -> bool

source

fn check_bounds_fail(self, slice: &JavaStr) -> !

source

unsafe fn get_unchecked(self, slice: *const JavaStr) -> *const JavaStr

§Safety
  • The input slice must be a valid pointer
  • This index must not be out of bounds of the input slice
  • The indices of this slice must point to char boundaries in the input slice
source

unsafe fn get_unchecked_mut(self, slice: *mut JavaStr) -> *mut JavaStr

§Safety
  • The input slice must be a valid pointer
  • This index must not be out of bounds of the input slice
  • The indices of this slice must point to char boundaries in the input slice

Provided Methods§

source

fn get(self, slice: &JavaStr) -> Option<&JavaStr>

source

fn get_mut(self, slice: &mut JavaStr) -> Option<&mut JavaStr>

source

fn index(self, slice: &JavaStr) -> &JavaStr

source

fn index_mut(self, slice: &mut JavaStr) -> &mut JavaStr

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl JavaStrSliceIndex for Range<usize>

source§

impl JavaStrSliceIndex for RangeFrom<usize>

source§

impl JavaStrSliceIndex for RangeFull

source§

impl JavaStrSliceIndex for RangeInclusive<usize>

source§

impl JavaStrSliceIndex for RangeTo<usize>

source§

impl JavaStrSliceIndex for RangeToInclusive<usize>

Implementors§