Struct UltralightApp

Source
pub struct UltralightApp<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> UltralightApp<'a>

Source

pub fn new( settings: Option<Settings>, config: Option<Config>, ) -> UltralightApp<'a>

Examples found in repository?
examples/basic_html.rs (lines 12-15)
6fn main() {
7    let mut config = ul::Config::new();
8    let settings = ul::Settings::new();
9
10    config.deviceScaleHint(2.0);
11
12    let mut ul_app = ul::UltralightApp::new(
13        Some(settings),
14        Some(config),
15    );
16
17    ul_app.window(
18        853u32,
19        480u32,
20        false,
21        false,
22        true,
23        true,
24        false,
25    );
26
27    let mut ul = ul::Ultralight::new(
28        None,
29        Some(ul_app.get_renderer()),
30    );
31
32    ul.app(&mut ul_app);
33
34    ul.log_to_stdout();
35
36    ul.load_html(r#"
37        <html>
38            <head>
39                <style>
40                    body {
41                        background-color: black;
42                        color: white;
43                        font-size: 100px;
44                    }
45                </style>
46            </head>
47            <body>Hello</body>
48        </html>"#);
49
50    // or ..
51    //ul.load_url("https://sly.mn");
52
53    ul_app.overlay_resize(853u32, 480u32);
54
55    let mut finished = |_| println!("loaded!");
56    let mut dom_ready = |_| println!("dom ready!");
57
58    ul.set_finish_loading_callback(&mut finished);
59    ul.set_dom_ready_callback(&mut dom_ready);
60
61    ul_app.window_set_resize_callback(&mut |width: u32, height: u32| {
62        ul_app.overlay_resize(width, height);
63    });
64
65    ul_app.run();
66}
Source

pub fn window( &mut self, height: u32, width: u32, fullscreen: bool, borderless: bool, titled: bool, resizable: bool, maximizable: bool, )

Examples found in repository?
examples/basic_html.rs (lines 17-25)
6fn main() {
7    let mut config = ul::Config::new();
8    let settings = ul::Settings::new();
9
10    config.deviceScaleHint(2.0);
11
12    let mut ul_app = ul::UltralightApp::new(
13        Some(settings),
14        Some(config),
15    );
16
17    ul_app.window(
18        853u32,
19        480u32,
20        false,
21        false,
22        true,
23        true,
24        false,
25    );
26
27    let mut ul = ul::Ultralight::new(
28        None,
29        Some(ul_app.get_renderer()),
30    );
31
32    ul.app(&mut ul_app);
33
34    ul.log_to_stdout();
35
36    ul.load_html(r#"
37        <html>
38            <head>
39                <style>
40                    body {
41                        background-color: black;
42                        color: white;
43                        font-size: 100px;
44                    }
45                </style>
46            </head>
47            <body>Hello</body>
48        </html>"#);
49
50    // or ..
51    //ul.load_url("https://sly.mn");
52
53    ul_app.overlay_resize(853u32, 480u32);
54
55    let mut finished = |_| println!("loaded!");
56    let mut dom_ready = |_| println!("dom ready!");
57
58    ul.set_finish_loading_callback(&mut finished);
59    ul.set_dom_ready_callback(&mut dom_ready);
60
61    ul_app.window_set_resize_callback(&mut |width: u32, height: u32| {
62        ul_app.overlay_resize(width, height);
63    });
64
65    ul_app.run();
66}
Source

pub fn get_renderer(&mut self) -> Renderer

Examples found in repository?
examples/basic_html.rs (line 29)
6fn main() {
7    let mut config = ul::Config::new();
8    let settings = ul::Settings::new();
9
10    config.deviceScaleHint(2.0);
11
12    let mut ul_app = ul::UltralightApp::new(
13        Some(settings),
14        Some(config),
15    );
16
17    ul_app.window(
18        853u32,
19        480u32,
20        false,
21        false,
22        true,
23        true,
24        false,
25    );
26
27    let mut ul = ul::Ultralight::new(
28        None,
29        Some(ul_app.get_renderer()),
30    );
31
32    ul.app(&mut ul_app);
33
34    ul.log_to_stdout();
35
36    ul.load_html(r#"
37        <html>
38            <head>
39                <style>
40                    body {
41                        background-color: black;
42                        color: white;
43                        font-size: 100px;
44                    }
45                </style>
46            </head>
47            <body>Hello</body>
48        </html>"#);
49
50    // or ..
51    //ul.load_url("https://sly.mn");
52
53    ul_app.overlay_resize(853u32, 480u32);
54
55    let mut finished = |_| println!("loaded!");
56    let mut dom_ready = |_| println!("dom ready!");
57
58    ul.set_finish_loading_callback(&mut finished);
59    ul.set_dom_ready_callback(&mut dom_ready);
60
61    ul_app.window_set_resize_callback(&mut |width: u32, height: u32| {
62        ul_app.overlay_resize(width, height);
63    });
64
65    ul_app.run();
66}
Source

pub fn run(&mut self)

Examples found in repository?
examples/basic_html.rs (line 65)
6fn main() {
7    let mut config = ul::Config::new();
8    let settings = ul::Settings::new();
9
10    config.deviceScaleHint(2.0);
11
12    let mut ul_app = ul::UltralightApp::new(
13        Some(settings),
14        Some(config),
15    );
16
17    ul_app.window(
18        853u32,
19        480u32,
20        false,
21        false,
22        true,
23        true,
24        false,
25    );
26
27    let mut ul = ul::Ultralight::new(
28        None,
29        Some(ul_app.get_renderer()),
30    );
31
32    ul.app(&mut ul_app);
33
34    ul.log_to_stdout();
35
36    ul.load_html(r#"
37        <html>
38            <head>
39                <style>
40                    body {
41                        background-color: black;
42                        color: white;
43                        font-size: 100px;
44                    }
45                </style>
46            </head>
47            <body>Hello</body>
48        </html>"#);
49
50    // or ..
51    //ul.load_url("https://sly.mn");
52
53    ul_app.overlay_resize(853u32, 480u32);
54
55    let mut finished = |_| println!("loaded!");
56    let mut dom_ready = |_| println!("dom ready!");
57
58    ul.set_finish_loading_callback(&mut finished);
59    ul.set_dom_ready_callback(&mut dom_ready);
60
61    ul_app.window_set_resize_callback(&mut |width: u32, height: u32| {
62        ul_app.overlay_resize(width, height);
63    });
64
65    ul_app.run();
66}

Trait Implementations§

Source§

impl<'a> UltralightAppOverlay for UltralightApp<'a>

Source§

impl<'a> UltralightAppWindow for UltralightApp<'a>

Source§

impl<'a> UltralightAppWindowCallbacks<'a> for UltralightApp<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for UltralightApp<'a>

§

impl<'a> RefUnwindSafe for UltralightApp<'a>

§

impl<'a> !Send for UltralightApp<'a>

§

impl<'a> !Sync for UltralightApp<'a>

§

impl<'a> Unpin for UltralightApp<'a>

§

impl<'a> UnwindSafe for UltralightApp<'a>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.