pub enum EscapeContext {
Python,
JavaScript,
Ruby,
Php,
Rust,
}Expand description
Language context for determining escape sequences and quote characters.
Different languages have different conventions for string literals:
- Python: Uses both single/double quotes and triple-quotes for docstrings
- JavaScript/TypeScript: Supports template literals with backticks, and single/double quotes
- Ruby: Uses both single and double quotes with different escape rules
- PHP: Requires strict escaping of backslashes and quotes
- Rust: Raw strings and standard escape sequences
Variants§
Python
Python (3.10+): Handles single/double quotes and triple-quoted strings
JavaScript
JavaScript/TypeScript: Template literals with backtick support
Ruby
Ruby: Single and double quoted strings with different escape sequences
Php
PHP: Single and double quoted strings with strict escaping rules
Rust
Rust: Standard escape sequences and raw strings
Trait Implementations§
Source§impl Clone for EscapeContext
impl Clone for EscapeContext
Source§fn clone(&self) -> EscapeContext
fn clone(&self) -> EscapeContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 EscapeContext
impl Debug for EscapeContext
Source§impl PartialEq for EscapeContext
impl PartialEq for EscapeContext
Source§fn eq(&self, other: &EscapeContext) -> bool
fn eq(&self, other: &EscapeContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for EscapeContext
impl Eq for EscapeContext
impl StructuralPartialEq for EscapeContext
Auto Trait Implementations§
impl Freeze for EscapeContext
impl RefUnwindSafe for EscapeContext
impl Send for EscapeContext
impl Sync for EscapeContext
impl Unpin for EscapeContext
impl UnsafeUnpin for EscapeContext
impl UnwindSafe for EscapeContext
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> 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.