pub struct CharConstant {
pub value: i64,
pub encoding: Encoding,
pub remarks: Remarks,
}Expand description
A converted character constant.
Fields§
§value: i64The value, already converted to the constant’s type, which is why it can be negative:
'\xff' is minus one where plain char is signed.
encoding: EncodingThe prefix it was written with.
remarks: RemarksWhat is worth saying about it, for the caller that holds the span.
Implementations§
Source§impl CharConstant
impl CharConstant
Sourcepub fn spell(self) -> String
pub fn spell(self) -> String
The spelling this constant would be written with, quotes and prefix included.
It is a spelling and not the spelling: the one the author wrote is gone by the time there is a value here. What it guarantees is that reading it back gives this constant, which is what a printer downstream needs and what a message quoting a constant wants.
A constant holding more than one character is written as the bytes it was shifted together from, most significant first, which is how it is read back.
Trait Implementations§
Source§impl Clone for CharConstant
impl Clone for CharConstant
Source§fn clone(&self) -> CharConstant
fn clone(&self) -> CharConstant
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 moreimpl Copy for CharConstant
Source§impl Debug for CharConstant
impl Debug for CharConstant
impl Eq for CharConstant
Source§impl PartialEq for CharConstant
impl PartialEq for CharConstant
impl StructuralPartialEq for CharConstant
Auto Trait Implementations§
impl Freeze for CharConstant
impl RefUnwindSafe for CharConstant
impl Send for CharConstant
impl Sync for CharConstant
impl Unpin for CharConstant
impl UnsafeUnpin for CharConstant
impl UnwindSafe for CharConstant
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