pub struct JavascriptResult { /* private fields */ }
Implementations§
Source§impl JavascriptResult
impl JavascriptResult
Sourcepub fn as_ptr(&self) -> *mut WebKitJavascriptResult
pub fn as_ptr(&self) -> *mut WebKitJavascriptResult
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const WebKitJavascriptResult,
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const WebKitJavascriptResult, ) -> &'a Self
Borrows the underlying C value.
Source§impl JavascriptResult
impl JavascriptResult
Sourcepub fn js_value(&self) -> Option<Value>
Available on crate feature v2_22
only.
pub fn js_value(&self) -> Option<Value>
v2_22
only.Examples found in repository?
examples/main.rs (line 63)
34fn main() {
35 gtk::init().unwrap();
36
37 let window = Window::new(WindowType::Toplevel);
38 let context = WebContext::default().unwrap();
39 #[cfg(feature = "v2_4")]
40 context.set_web_extensions_initialization_user_data(&"webkit".to_variant());
41 context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/");
42 #[cfg(feature = "v2_6")]
43 let webview =
44 WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new());
45 #[cfg(not(feature = "v2_6"))]
46 let webview = WebView::with_context(&context);
47 webview.load_uri("https://crates.io/");
48 window.add(&webview);
49
50 let settings = WebViewExt::settings(&webview).unwrap();
51 settings.set_enable_developer_extras(true);
52
53 /*let inspector = webview.get_inspector().unwrap();
54 inspector.show();*/
55
56 window.show_all();
57
58 webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {});
59 #[cfg(feature = "v2_22")]
60 webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result {
61 Ok(result) => {
62 use java_script_core::ValueExt;
63 let value = result.js_value().unwrap();
64 println!("is_boolean: {}", value.is_boolean());
65 println!("is_number: {}", value.is_number());
66 println!("{:?}", value.to_int32());
67 println!("{:?}", value.to_boolean());
68 }
69 Err(error) => println!("{}", error),
70 });
71
72 window.connect_delete_event(|_, _| {
73 gtk::main_quit();
74 glib::Propagation::Proceed
75 });
76
77 gtk::main();
78}
Trait Implementations§
Source§impl Clone for JavascriptResult
impl Clone for JavascriptResult
Source§impl Debug for JavascriptResult
impl Debug for JavascriptResult
Source§impl From<JavascriptResult> for Value
impl From<JavascriptResult> for Value
Source§fn from(s: JavascriptResult) -> Self
fn from(s: JavascriptResult) -> Self
Converts to this type from the input type.
Source§impl HasParamSpec for JavascriptResult
impl HasParamSpec for JavascriptResult
type ParamSpec = ParamSpecBoxed
Source§type SetValue = JavascriptResult
type SetValue = JavascriptResult
Preferred value to be used as setter for the associated ParamSpec.
type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, JavascriptResult>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for JavascriptResult
impl Hash for JavascriptResult
Source§impl Ord for JavascriptResult
impl Ord for JavascriptResult
Source§fn cmp(&self, other: &JavascriptResult) -> Ordering
fn cmp(&self, other: &JavascriptResult) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for JavascriptResult
impl PartialEq for JavascriptResult
Source§impl PartialOrd for JavascriptResult
impl PartialOrd for JavascriptResult
Source§impl StaticType for JavascriptResult
impl StaticType for JavascriptResult
Source§fn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of
Self
.impl Eq for JavascriptResult
impl StructuralPartialEq for JavascriptResult
Auto Trait Implementations§
impl Freeze for JavascriptResult
impl RefUnwindSafe for JavascriptResult
impl !Send for JavascriptResult
impl !Sync for JavascriptResult
impl Unpin for JavascriptResult
impl UnwindSafe for JavascriptResult
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for Twhere
T: GlibPtrDefault + FromGlibPtrNone<<T as GlibPtrDefault>::GlibType> + FromGlibPtrFull<<T as GlibPtrDefault>::GlibType>,
Source§impl<T> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
Source§impl<T> PropertyGet for Twhere
T: HasParamSpec,
impl<T> PropertyGet for Twhere
T: HasParamSpec,
Source§impl<T> StaticTypeExt for Twhere
T: StaticType,
impl<T> StaticTypeExt for Twhere
T: StaticType,
Source§fn ensure_type()
fn ensure_type()
Ensures that the type has been registered with the type system.