pub struct Utf16SourceLocation {
pub line_number: u32,
pub line_position: u32,
pub offset: u32,
pub length: u32,
}Expand description
A human-readable representation for a span, tailored for text source.
Corresponds to the positional members of GPUCompilationMessage from
the WebGPU specification.
Unlike SourceLocation, which uses UTF-8 units as a convenience for the
wgpu Rust API, this struct locates the span using UTF-16 code units, just
like the WebGPU specification.
Fields§
§line_number: u321-based line number.
line_position: u321-based column in UTF-16 code units of the start of the span. Remember to convert accordingly when displaying to the user.
offset: u320-based offset in UTF-16 code units of the start of the span.
length: u32Length in UTF-16 code units of the span.
Implementations§
Source§impl Utf16SourceLocation
impl Utf16SourceLocation
Sourcepub fn to_utf8(&self, source: &str) -> SourceLocation
pub fn to_utf8(&self, source: &str) -> SourceLocation
Converts a SourceLocation in UTF-16 code units to UTF-8 code units.
Trait Implementations§
Source§impl Clone for Utf16SourceLocation
impl Clone for Utf16SourceLocation
Source§fn clone(&self) -> Utf16SourceLocation
fn clone(&self) -> Utf16SourceLocation
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 moreSource§impl Debug for Utf16SourceLocation
impl Debug for Utf16SourceLocation
Source§impl<'de> Deserialize<'de> for Utf16SourceLocation
impl<'de> Deserialize<'de> for Utf16SourceLocation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Utf16SourceLocation
impl PartialEq for Utf16SourceLocation
Source§impl Serialize for Utf16SourceLocation
impl Serialize for Utf16SourceLocation
impl Copy for Utf16SourceLocation
impl Eq for Utf16SourceLocation
impl StructuralPartialEq for Utf16SourceLocation
Auto Trait Implementations§
impl Freeze for Utf16SourceLocation
impl RefUnwindSafe for Utf16SourceLocation
impl Send for Utf16SourceLocation
impl Sync for Utf16SourceLocation
impl Unpin for Utf16SourceLocation
impl UnsafeUnpin for Utf16SourceLocation
impl UnwindSafe for Utf16SourceLocation
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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