Skip to main content

browser/
browser.rs

1// Requires a live GemStone/S stone.
2//
3// Expected output includes dictionary, protocol, method, and source sections:
4//
5// Dictionaries:
6// First Object protocols:
7// First Object methods:
8// Object>>printString source:
9
10use gemstone_rs::{
11    browser::{Browser, ALL_PROTOCOLS},
12    Config, Session,
13};
14
15fn main() -> gemstone_rs::Result<()> {
16    let mut session = Session::login(Config::from_env()?)?;
17    let mut browser = Browser::new(&mut session);
18
19    println!("Dictionaries:");
20    for dictionary in browser.dictionaries()?.into_iter().take(10) {
21        println!("  {dictionary}");
22    }
23
24    println!("\nFirst Object protocols:");
25    for protocol in browser.protocols("Object", false, "")?.into_iter().take(10) {
26        println!("  {protocol}");
27    }
28
29    println!("\nFirst Object methods:");
30    for selector in browser
31        .methods("Object", ALL_PROTOCOLS, false, "")?
32        .into_iter()
33        .take(10)
34    {
35        println!("  {selector}");
36    }
37
38    println!("\nObject>>printString source:");
39    println!("{}", browser.source("Object", "printString", false, "")?);
40    Ok(())
41}