pub struct ShaderPosition {
pub line: u32,
pub pos: u32,
}Expand description
Position in a single file with line and character
Fields§
§line: u32§pos: u32Implementations§
Source§impl ShaderPosition
impl ShaderPosition
Sourcepub fn into_file(self, file_path: PathBuf) -> ShaderFilePosition
pub fn into_file(self, file_path: PathBuf) -> ShaderFilePosition
Convert a ShaderPosition into a ShaderFilePosition
Sourcepub fn clone_into_file(&self, file_path: PathBuf) -> ShaderFilePosition
pub fn clone_into_file(&self, file_path: PathBuf) -> ShaderFilePosition
Clone a ShaderPosition to a ShaderFilePosition
Sourcepub fn from_byte_offset(
content: &str,
byte_offset: usize,
) -> Result<ShaderPosition>
pub fn from_byte_offset( content: &str, byte_offset: usize, ) -> Result<ShaderPosition>
Compute the line and pos in a given content from the given byte offset. This is handling UTF8 string aswell and should safely return a correct position.
Sourcepub fn to_byte_offset(&self, content: &str) -> Result<usize>
pub fn to_byte_offset(&self, content: &str) -> Result<usize>
Compute the byte offset in a given content from the given line and pos. This is handling UTF8 string aswell and should safely return a byte offset at character boundary.
Trait Implementations§
Source§impl Clone for ShaderPosition
impl Clone for ShaderPosition
Source§fn clone(&self) -> ShaderPosition
fn clone(&self) -> ShaderPosition
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 ShaderPosition
impl Debug for ShaderPosition
Source§impl Default for ShaderPosition
impl Default for ShaderPosition
Source§fn default() -> ShaderPosition
fn default() -> ShaderPosition
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ShaderPosition
impl<'de> Deserialize<'de> for ShaderPosition
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 From<Point> for ShaderPosition
impl From<Point> for ShaderPosition
Source§impl Ord for ShaderPosition
impl Ord for ShaderPosition
Source§impl PartialEq for ShaderPosition
impl PartialEq for ShaderPosition
Source§impl PartialOrd for ShaderPosition
impl PartialOrd for ShaderPosition
Source§impl Serialize for ShaderPosition
impl Serialize for ShaderPosition
impl Eq for ShaderPosition
Auto Trait Implementations§
impl Freeze for ShaderPosition
impl RefUnwindSafe for ShaderPosition
impl Send for ShaderPosition
impl Sync for ShaderPosition
impl Unpin for ShaderPosition
impl UnwindSafe for ShaderPosition
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.