#[non_exhaustive]pub enum Encoding {
Utf8,
Utf16,
}Expand description
The unit a Position’s column is counted in.
The protocol’s default is UTF-16 code units, which every client supports.
Since LSP 3.17 a client may offer others in general.positionEncodings;
the server picks UTF-8 whenever it is offered, because a byte column
converts to a byte offset with no scanning at all, and otherwise stays with
UTF-16, the one encoding every client must accept. The choice is announced
to the client in the initialize result and applies to every document for
the whole session.
| Variant | Unit | é | 😀 |
|---|---|---|---|
Utf8 | bytes | 2 | 4 |
Utf16 | UTF-16 code units | 1 | 2 |
§Examples
use lsp_lang::Encoding;
assert_eq!(Encoding::default(), Encoding::Utf16);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Utf8
Columns count UTF-8 bytes ("utf-8").
Utf16
Columns count UTF-16 code units ("utf-16"), the protocol default.
Trait Implementations§
impl Copy for Encoding
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Forget for Encoding
impl Freeze for Encoding
impl Move for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnsafeUnpin for Encoding
impl UnwindSafe for Encoding
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