Skip to main content

AppSettings

Struct AppSettings 

Source
pub struct AppSettings {
Show 25 fields pub window_title: String, pub application_id: Option<String>, pub capabilities: Capabilities<'static>, pub window_icon: Option<ImageBitmap>, pub initial_width: u32, pub initial_height: u32, pub initial_size_explicit: bool, pub primary_wraps_content: bool, pub web_fill_viewport: bool, pub web_accessibility_on_start: bool, pub custom_cursor_size: CustomCursorSize, pub fonts: Option<&'static [&'static [u8]]>, pub font_registry: SoftwareTextFontRegistry, pub android_system_fonts: bool, pub android_gpu_backend: AndroidGpuBackend, pub log_tag: Option<String>, pub process_start: Option<fn()>, pub android_overlay_window: Option<AndroidOverlayWindowOptions>, pub headless: bool, pub developer_inspector: Option<bool>, pub gpu_requirements: GpuRequirements, pub dev_options: DevOptions, pub frame_pacing_mode: FramePacingMode, pub frame_pacing_explicit: bool, pub record_to: Option<PathBuf>, /* private fields */
}
Expand description

Configuration for application settings.

Fields§

§window_title: String

Window title (desktop) / app name (mobile)

§application_id: Option<String>

The id every framework-owned storage path is scoped by.

Android and iOS take it from what the platform packaged; a desktop or web build states it here. Left unset, the desktop backend derives one from the executable name, which is right for a development build and wrong for a shipped one.

§capabilities: Capabilities<'static>

What this application declared it asks of a device.

The same declaration the platform builds read, so a service can answer on every platform without each one keeping its own list.

§window_icon: Option<ImageBitmap>

Desktop only: the picture every window the application opens carries.

Windows shows it in the title bar, the taskbar and the task switcher, and Linux desktops show it in their panels and switchers. macOS, Android, iOS and the web take the application’s icon from what the platform packaged and ignore this field.

§initial_width: u32

Initial window width in logical pixels.

§initial_height: u32

Initial window height in logical pixels.

§initial_size_explicit: bool

Whether the initial size was explicitly supplied by the app.

§primary_wraps_content: bool

Desktop only: keep the primary window the size of what it lays out.

§web_fill_viewport: bool

Web only: give the canvas the full browser viewport instead of the box the host page lays it out in.

The default leaves the canvas box to the page’s own stylesheet, so a canvas nested in a phone frame, a card or any clipping container keeps the size that container gives it. An app that owns the whole page opts in here and the canvas fills the dynamic viewport, tracking the browser window as it resizes; other platforms ignore this field.

§web_accessibility_on_start: bool

Web only: build the accessibility mirror from the first frame.

By default a web app builds no semantics and no mirror. The page holds one button, “Enable accessibility”, that a screen reader finds first, and the mirror is built when a reader presses it, as Flutter’s web engine does. An app whose readers should not have to press it sets this, at the cost of the mirror on every page load; other platforms ignore this field.

§custom_cursor_size: CustomCursorSize

Desktop and web: how big an app’s own cursor images appear when the person has enlarged the system pointer.

Left at CustomCursorSize::FollowSystem, they grow with it, as the standard cursors do. An app whose cursors are pixel art drawn at an exact size can ask for CustomCursorSize::AsDrawn instead; on the web the page then draws such a cursor itself, since a browser leaves the size of a CSS cursor to the system.

§fonts: Option<&'static [&'static [u8]]>

Fonts loaded for text rendering (ordered: primary first, fallbacks last).

§font_registry: SoftwareTextFontRegistry

App-supplied font families, already read and parsed.

This is where fonts that are not compiled into the binary live: files on disk, platform system fonts, APK assets. Faces registered here carry the FontFamily an app names them by, so a TextStyle asking for that family resolves to them for both measurement and drawing.

§android_system_fonts: bool

Whether to register the platform’s generic families on Android (default: false).

§android_gpu_backend: AndroidGpuBackend

Graphics API selected for the Android WGPU renderer.

§log_tag: Option<String>

The tag this application’s log lines carry.

Android routes every log line through one tag, and adb logcat -s <tag> is how anyone reads them; an application that wants its own name there had to initialise the platform logger itself, before the framework did, and hope the ordering held. Naming it here removes both the platform call and the race. Unset, lines carry Cranpose.

§process_start: Option<fn()>

Runs once per process, before the first composition and whether or not a window ever opens. See AppLauncher::with_process_start.

§android_overlay_window: Option<AndroidOverlayWindowOptions>

Optional Android overlay surface configuration.

§headless: bool

Run in headless mode (window hidden, for robot testing)

When enabled, the window is created but not shown. This allows robot tests to run in parallel without cluttering the screen and enables CI environments without a display server.

§developer_inspector: Option<bool>

Override the developer inspector default. Unset enables it in debug builds; installing a robot driver defaults it to disabled unless explicitly set.

§gpu_requirements: GpuRequirements

What code that renders with Cranpose’s device needs from it beyond Cranpose’s own requests. The desktop window, the web page and embedded views ask for it.

§dev_options: DevOptions

Development options for debugging and performance monitoring

§frame_pacing_mode: FramePacingMode

Initial desktop frame pacing mode.

§frame_pacing_explicit: bool

Whether the app chose a frame pacing mode explicitly. Installing a robot test driver lifts the vsync cap only when this is false.

§record_to: Option<PathBuf>

Optional path to record input events to (for generating robot tests)

Implementations§

Source§

impl AppSettings

Source

pub fn start_process(&self)

Runs process_start, at most once per process.

Every platform entry point calls it once its services are in place; a host that drives Cranpose itself calls it at the same point.

Source

pub fn resolve_font_set(&self) -> SoftwareTextFontSet

The font set every platform entry point hands its renderer.

One definition so the platforms cannot drift, and so the measurer and the rasterizer are built from the same faces: app-registered families first, then the static with_fonts() slices as unnamed fallbacks. A launcher the app gave no fonts serves the embedded default face.

Trait Implementations§

Source§

impl Default for AppSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more