pub struct Sugarloaf {
pub ctx: Context,
pub layout: SugarloafLayout,
/* private fields */
}
Fields§
§ctx: Context
§layout: SugarloafLayout
Implementations§
source§impl Sugarloaf
impl Sugarloaf
pub async fn new( raw_window_handle: &SugarloafWindow, renderer: SugarloafRenderer, fonts: SugarloafFonts, layout: SugarloafLayout, db: Option<&Database> ) -> Result<Sugarloaf, SugarloafWithErrors>
pub fn clear(&mut self)
pub fn update_font( &mut self, fonts: SugarloafFonts, db: Option<&Database> ) -> Option<SugarloafErrors>
pub fn find_scale( &mut self, target_scale: f32, content: char, font_id: FontId ) -> Option<f32>
pub fn get_font_id(&mut self, sugar: &mut Sugar) -> CachedSugar
pub fn stack(&mut self, stack: SugarStack)
pub fn get_context(&self) -> &Context
pub fn get_scale(&self) -> f32
pub fn get_font_bounds( &mut self, content: char, font_id: FontId, scale: f32 ) -> (f32, f32)
pub fn set_background_color(&mut self, color: Color) -> &mut Self
pub fn set_background_image(&mut self, image: &ImageProperties) -> &mut Self
sourcepub fn calculate_bounds(&mut self)
pub fn calculate_bounds(&mut self)
calculate_bounds is a fake render operation that defines font bounds is an important function to figure out the cursor dimensions and background color but should be used as minimal as possible.
For example: It is used in Rio terminal only in the initialization and configuration updates that leads to layout recalculation.
pub fn pile_rects(&mut self, instances: Vec<Rect>) -> &mut Self
pub fn text( &mut self, pos: (f32, f32), text_str: String, font_id_usize: usize, scale: f32, color: [f32; 4], single_line: bool ) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Sugarloaf
impl !RefUnwindSafe for Sugarloaf
impl Send for Sugarloaf
impl !Sync for Sugarloaf
impl Unpin for Sugarloaf
impl !UnwindSafe for Sugarloaf
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more