#[repr(u32)]pub enum ruby_rstring_flags {
RSTRING_NOEMBED = 8_192,
RSTRING_FSTR = 536_870_912,
}Expand description
§Private
Bits that you can set to ::RBasic::flags.
@warning These enums are not the only bits we use for strings.
@internal
§Actually all bits through FL_USER1 to FL_USER19 are used for strings. Why only this tiny part of them are made public here? @shyouhei can find no reason.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
Variants§
RSTRING_NOEMBED = 8_192
This flag has something to do with memory footprint. If the string is short enough, ruby tries to be creative to abuse padding bits of struct ::RString for storing contents. If this flag is set that string does not do that, to resort to good old fashioned external allocation strategy instead.
@warning This bit has to be considered read-only. Setting/clearing this bit without corresponding fix up must cause immediate SEGV. Also, internal structures of a string change dynamically and transparently throughout of its lifetime. Don’t assume it being persistent.
@internal
§3rd parties must not be aware that there even is more than one way to store a string. Might better be hidden.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
RSTRING_FSTR = 536_870_912
This flag has something to do with infamous “f“string. What is a fstring? Well it is a special subkind of strings that is immutable, deduped globally, and managed by our GC. It is much like a Symbol (in fact Symbols are dynamic these days and are backended using fstrings). This concept has been silently introduced at some point in 2.x era. Since then it gained wider acceptance in the core. But extension libraries could not know that until very recently. Strings of this flag live in a special Limbo deep inside of the interpreter. Never try to manipulate it by hand.
@internal
§Fstrings are not the only variant strings that we implement today. Other things are behind-the-scene. This is the only one that is visible from extension library. There is no clear reason why it has to be. Given there are more “polite” ways to create fstrings, it seems this bit need not be exposed to extension libraries. Might better be hidden.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3
Trait Implementations§
Source§impl Clone for ruby_rstring_flags
impl Clone for ruby_rstring_flags
Source§fn clone(&self) -> ruby_rstring_flags
fn clone(&self) -> ruby_rstring_flags
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ruby_rstring_flags
impl Debug for ruby_rstring_flags
Source§impl Hash for ruby_rstring_flags
impl Hash for ruby_rstring_flags
Source§impl PartialEq for ruby_rstring_flags
impl PartialEq for ruby_rstring_flags
impl Copy for ruby_rstring_flags
impl Eq for ruby_rstring_flags
impl StructuralPartialEq for ruby_rstring_flags
Auto Trait Implementations§
impl Freeze for ruby_rstring_flags
impl RefUnwindSafe for ruby_rstring_flags
impl Send for ruby_rstring_flags
impl Sync for ruby_rstring_flags
impl Unpin for ruby_rstring_flags
impl UnwindSafe for ruby_rstring_flags
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)