GetDisjointMutError — 중복 가변 접근 오류
GetDisjointMutError — 중복 가변 접근 오류
GetDisjointMutError는 get_disjoint_mut가 반환하는 오류 타입이에요.
출처: Rust 공식 문서
본문
pub enum GetDisjointMutError {
IndexOutOfBounds,
OverlappingIndices,
}
다음 두 가지 오류 중 하나를 나타내요.
IndexOutOfBounds— 인덱스가 범위를 벗어났어요.OverlappingIndices— 같은 인덱스가 배열에 여러 번 나타났거나(또는 범위가 주어졌을 때 서로 다르지만 겹치는 인덱스), 서로 겹치는 인덱스가 존재해요.
예시
use std::slice::GetDisjointMutError;
let v = &mut [1, 2, 3];
// 겹치는 인덱스 때문에 오류가 발생해요.
assert_eq!(v.get_disjoint_mut([0, 0]), Err(GetDisjointMutError::OverlappingIndices));