pub struct CharPositions { /* private fields */ }Expand description
문자 위치 정보
UTF-8에서 문자 위치와 바이트 위치의 매핑
Implementations§
Source§impl CharPositions
impl CharPositions
Sourcepub fn char_to_byte(&self, char_pos: usize) -> usize
pub fn char_to_byte(&self, char_pos: usize) -> usize
문자 위치 → 바이트 위치 변환
Sourcepub fn char_count(&self) -> usize
pub fn char_count(&self) -> usize
문자 개수
Sourcepub fn byte_to_char(&self, byte_pos: usize) -> usize
pub fn byte_to_char(&self, byte_pos: usize) -> usize
바이트 위치 → 문자 위치 변환 (binary search)
Returns the char index whose byte start equals byte_pos, or
char_count() if not found (e.g. byte_pos == total_bytes).
Sourcepub const fn byte_count(&self) -> usize
pub const fn byte_count(&self) -> usize
총 바이트 수
Trait Implementations§
Source§impl Clone for CharPositions
impl Clone for CharPositions
Source§fn clone(&self) -> CharPositions
fn clone(&self) -> CharPositions
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CharPositions
impl RefUnwindSafe for CharPositions
impl Send for CharPositions
impl Sync for CharPositions
impl Unpin for CharPositions
impl UnsafeUnpin for CharPositions
impl UnwindSafe for CharPositions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more