pub struct BrowserEngine { /* private fields */ }Implementations§
Source§impl BrowserEngine
impl BrowserEngine
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Examples found in repository?
examples/multitab_concurrent.rs (line 11)
6async fn main() -> Result<()> {
7 println!("================================================================================");
8 println!(">>> MULTI-TAB CONCURRENT ENGINE DEMO (<50MB RAM)");
9 println!("================================================================================\n");
10
11 let mut engine = BrowserEngine::new()?;
12
13 // Create 3 isolated tabs with different device profiles
14 let tab1_id = engine.create_tab(Some(DeviceProfile::ChromeWindows))?;
15 let tab2_id = engine.create_tab(Some(DeviceProfile::SafariMac))?;
16 let tab3_id = engine.create_tab(Some(DeviceProfile::SafariIos))?;
17
18 println!("Created tabs: {}, {}, {}", tab1_id, tab2_id, tab3_id);
19
20 println!("[Tab 1: Chrome Windows] Navigating to Wikipedia...");
21 let r1 = engine
22 .get_tab_mut(&tab1_id)
23 .unwrap()
24 .navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")
25 .await?;
26 println!(" -> Tab 1 Title: {}", r1.page_title);
27
28 println!("[Tab 2: Safari Mac] Navigating to Hacker News...");
29 let r2 = engine
30 .get_tab_mut(&tab2_id)
31 .unwrap()
32 .navigate("https://news.ycombinator.com/")
33 .await?;
34 println!(" -> Tab 2 Title: {}", r2.page_title);
35
36 println!("[Tab 3: iPhone iOS] Navigating to GitHub Explore...");
37 let r3 = engine
38 .get_tab_mut(&tab3_id)
39 .unwrap()
40 .navigate("https://github.com/trending")
41 .await?;
42 println!(" -> Tab 3 Title: {}", r3.page_title);
43
44 println!("\n>>> Active Tabs List:");
45 for tab_info in engine.list_tabs() {
46 println!(
47 " - ID: {:<8} Profile: {:<15} URL: {:?}",
48 tab_info.id,
49 format!("{:?}", tab_info.profile),
50 tab_info.url
51 );
52 }
53
54 println!("\n>>> Closing Tab 2...");
55 engine.close_tab(&tab2_id);
56 println!("Remaining tabs count: {}", engine.list_tabs().len());
57
58 Ok(())
59}pub fn with_builder(builder: BrowserBuilder) -> Result<Self>
Sourcepub fn create_tab(&mut self, profile: Option<DeviceProfile>) -> Result<String>
pub fn create_tab(&mut self, profile: Option<DeviceProfile>) -> Result<String>
Examples found in repository?
examples/multitab_concurrent.rs (line 14)
6async fn main() -> Result<()> {
7 println!("================================================================================");
8 println!(">>> MULTI-TAB CONCURRENT ENGINE DEMO (<50MB RAM)");
9 println!("================================================================================\n");
10
11 let mut engine = BrowserEngine::new()?;
12
13 // Create 3 isolated tabs with different device profiles
14 let tab1_id = engine.create_tab(Some(DeviceProfile::ChromeWindows))?;
15 let tab2_id = engine.create_tab(Some(DeviceProfile::SafariMac))?;
16 let tab3_id = engine.create_tab(Some(DeviceProfile::SafariIos))?;
17
18 println!("Created tabs: {}, {}, {}", tab1_id, tab2_id, tab3_id);
19
20 println!("[Tab 1: Chrome Windows] Navigating to Wikipedia...");
21 let r1 = engine
22 .get_tab_mut(&tab1_id)
23 .unwrap()
24 .navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")
25 .await?;
26 println!(" -> Tab 1 Title: {}", r1.page_title);
27
28 println!("[Tab 2: Safari Mac] Navigating to Hacker News...");
29 let r2 = engine
30 .get_tab_mut(&tab2_id)
31 .unwrap()
32 .navigate("https://news.ycombinator.com/")
33 .await?;
34 println!(" -> Tab 2 Title: {}", r2.page_title);
35
36 println!("[Tab 3: iPhone iOS] Navigating to GitHub Explore...");
37 let r3 = engine
38 .get_tab_mut(&tab3_id)
39 .unwrap()
40 .navigate("https://github.com/trending")
41 .await?;
42 println!(" -> Tab 3 Title: {}", r3.page_title);
43
44 println!("\n>>> Active Tabs List:");
45 for tab_info in engine.list_tabs() {
46 println!(
47 " - ID: {:<8} Profile: {:<15} URL: {:?}",
48 tab_info.id,
49 format!("{:?}", tab_info.profile),
50 tab_info.url
51 );
52 }
53
54 println!("\n>>> Closing Tab 2...");
55 engine.close_tab(&tab2_id);
56 println!("Remaining tabs count: {}", engine.list_tabs().len());
57
58 Ok(())
59}pub fn get_tab(&self, tab_id: &str) -> Option<&BrowserTab>
Sourcepub fn get_tab_mut(&mut self, tab_id: &str) -> Option<&mut BrowserTab>
pub fn get_tab_mut(&mut self, tab_id: &str) -> Option<&mut BrowserTab>
Examples found in repository?
examples/multitab_concurrent.rs (line 22)
6async fn main() -> Result<()> {
7 println!("================================================================================");
8 println!(">>> MULTI-TAB CONCURRENT ENGINE DEMO (<50MB RAM)");
9 println!("================================================================================\n");
10
11 let mut engine = BrowserEngine::new()?;
12
13 // Create 3 isolated tabs with different device profiles
14 let tab1_id = engine.create_tab(Some(DeviceProfile::ChromeWindows))?;
15 let tab2_id = engine.create_tab(Some(DeviceProfile::SafariMac))?;
16 let tab3_id = engine.create_tab(Some(DeviceProfile::SafariIos))?;
17
18 println!("Created tabs: {}, {}, {}", tab1_id, tab2_id, tab3_id);
19
20 println!("[Tab 1: Chrome Windows] Navigating to Wikipedia...");
21 let r1 = engine
22 .get_tab_mut(&tab1_id)
23 .unwrap()
24 .navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")
25 .await?;
26 println!(" -> Tab 1 Title: {}", r1.page_title);
27
28 println!("[Tab 2: Safari Mac] Navigating to Hacker News...");
29 let r2 = engine
30 .get_tab_mut(&tab2_id)
31 .unwrap()
32 .navigate("https://news.ycombinator.com/")
33 .await?;
34 println!(" -> Tab 2 Title: {}", r2.page_title);
35
36 println!("[Tab 3: iPhone iOS] Navigating to GitHub Explore...");
37 let r3 = engine
38 .get_tab_mut(&tab3_id)
39 .unwrap()
40 .navigate("https://github.com/trending")
41 .await?;
42 println!(" -> Tab 3 Title: {}", r3.page_title);
43
44 println!("\n>>> Active Tabs List:");
45 for tab_info in engine.list_tabs() {
46 println!(
47 " - ID: {:<8} Profile: {:<15} URL: {:?}",
48 tab_info.id,
49 format!("{:?}", tab_info.profile),
50 tab_info.url
51 );
52 }
53
54 println!("\n>>> Closing Tab 2...");
55 engine.close_tab(&tab2_id);
56 println!("Remaining tabs count: {}", engine.list_tabs().len());
57
58 Ok(())
59}Sourcepub fn close_tab(&mut self, tab_id: &str) -> bool
pub fn close_tab(&mut self, tab_id: &str) -> bool
Examples found in repository?
examples/multitab_concurrent.rs (line 55)
6async fn main() -> Result<()> {
7 println!("================================================================================");
8 println!(">>> MULTI-TAB CONCURRENT ENGINE DEMO (<50MB RAM)");
9 println!("================================================================================\n");
10
11 let mut engine = BrowserEngine::new()?;
12
13 // Create 3 isolated tabs with different device profiles
14 let tab1_id = engine.create_tab(Some(DeviceProfile::ChromeWindows))?;
15 let tab2_id = engine.create_tab(Some(DeviceProfile::SafariMac))?;
16 let tab3_id = engine.create_tab(Some(DeviceProfile::SafariIos))?;
17
18 println!("Created tabs: {}, {}, {}", tab1_id, tab2_id, tab3_id);
19
20 println!("[Tab 1: Chrome Windows] Navigating to Wikipedia...");
21 let r1 = engine
22 .get_tab_mut(&tab1_id)
23 .unwrap()
24 .navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")
25 .await?;
26 println!(" -> Tab 1 Title: {}", r1.page_title);
27
28 println!("[Tab 2: Safari Mac] Navigating to Hacker News...");
29 let r2 = engine
30 .get_tab_mut(&tab2_id)
31 .unwrap()
32 .navigate("https://news.ycombinator.com/")
33 .await?;
34 println!(" -> Tab 2 Title: {}", r2.page_title);
35
36 println!("[Tab 3: iPhone iOS] Navigating to GitHub Explore...");
37 let r3 = engine
38 .get_tab_mut(&tab3_id)
39 .unwrap()
40 .navigate("https://github.com/trending")
41 .await?;
42 println!(" -> Tab 3 Title: {}", r3.page_title);
43
44 println!("\n>>> Active Tabs List:");
45 for tab_info in engine.list_tabs() {
46 println!(
47 " - ID: {:<8} Profile: {:<15} URL: {:?}",
48 tab_info.id,
49 format!("{:?}", tab_info.profile),
50 tab_info.url
51 );
52 }
53
54 println!("\n>>> Closing Tab 2...");
55 engine.close_tab(&tab2_id);
56 println!("Remaining tabs count: {}", engine.list_tabs().len());
57
58 Ok(())
59}Sourcepub fn list_tabs(&self) -> Vec<TabSummary>
pub fn list_tabs(&self) -> Vec<TabSummary>
Examples found in repository?
examples/multitab_concurrent.rs (line 45)
6async fn main() -> Result<()> {
7 println!("================================================================================");
8 println!(">>> MULTI-TAB CONCURRENT ENGINE DEMO (<50MB RAM)");
9 println!("================================================================================\n");
10
11 let mut engine = BrowserEngine::new()?;
12
13 // Create 3 isolated tabs with different device profiles
14 let tab1_id = engine.create_tab(Some(DeviceProfile::ChromeWindows))?;
15 let tab2_id = engine.create_tab(Some(DeviceProfile::SafariMac))?;
16 let tab3_id = engine.create_tab(Some(DeviceProfile::SafariIos))?;
17
18 println!("Created tabs: {}, {}, {}", tab1_id, tab2_id, tab3_id);
19
20 println!("[Tab 1: Chrome Windows] Navigating to Wikipedia...");
21 let r1 = engine
22 .get_tab_mut(&tab1_id)
23 .unwrap()
24 .navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")
25 .await?;
26 println!(" -> Tab 1 Title: {}", r1.page_title);
27
28 println!("[Tab 2: Safari Mac] Navigating to Hacker News...");
29 let r2 = engine
30 .get_tab_mut(&tab2_id)
31 .unwrap()
32 .navigate("https://news.ycombinator.com/")
33 .await?;
34 println!(" -> Tab 2 Title: {}", r2.page_title);
35
36 println!("[Tab 3: iPhone iOS] Navigating to GitHub Explore...");
37 let r3 = engine
38 .get_tab_mut(&tab3_id)
39 .unwrap()
40 .navigate("https://github.com/trending")
41 .await?;
42 println!(" -> Tab 3 Title: {}", r3.page_title);
43
44 println!("\n>>> Active Tabs List:");
45 for tab_info in engine.list_tabs() {
46 println!(
47 " - ID: {:<8} Profile: {:<15} URL: {:?}",
48 tab_info.id,
49 format!("{:?}", tab_info.profile),
50 tab_info.url
51 );
52 }
53
54 println!("\n>>> Closing Tab 2...");
55 engine.close_tab(&tab2_id);
56 println!("Remaining tabs count: {}", engine.list_tabs().len());
57
58 Ok(())
59}pub fn default_tab_mut(&mut self) -> Result<&mut BrowserTab>
Auto Trait Implementations§
impl !RefUnwindSafe for BrowserEngine
impl !Send for BrowserEngine
impl !Sync for BrowserEngine
impl !UnwindSafe for BrowserEngine
impl Freeze for BrowserEngine
impl Unpin for BrowserEngine
impl UnsafeUnpin for BrowserEngine
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.