Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/bump-gir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"javascriptcore-rs": major
"javascriptcore-rs-sys": major
---

Bumped `gir` to `ee0e85140a6f` and regenerated bindings.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ version = "1.1.2"

[package.metadata.docs.rs]
all-features = true
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]

[lib]
name = "javascriptcore"
Expand Down
2 changes: 1 addition & 1 deletion gir
Submodule gir updated 131 files
1 change: 1 addition & 0 deletions src/auto/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
Expand Down
24 changes: 12 additions & 12 deletions src/auto/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::{CheckSyntaxMode, CheckSyntaxResult, Exception, Value, VirtualMachine};
use crate::{ffi, CheckSyntaxMode, CheckSyntaxResult, Exception, Value, VirtualMachine};
use glib::{prelude::*, translate::*};
use std::boxed::Box as Box_;

Expand Down Expand Up @@ -86,12 +86,7 @@ impl ContextBuilder {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Context>> Sealed for T {}
}

pub trait ContextExt: IsA<Context> + sealed::Sealed + 'static {
pub trait ContextExt: IsA<Context> + 'static {
#[doc(alias = "jsc_context_check_syntax")]
fn check_syntax(
&self,
Expand Down Expand Up @@ -187,6 +182,7 @@ pub trait ContextExt: IsA<Context> + sealed::Sealed + 'static {

#[doc(alias = "jsc_context_get_virtual_machine")]
#[doc(alias = "get_virtual_machine")]
#[doc(alias = "virtual-machine")]
fn virtual_machine(&self) -> Option<VirtualMachine> {
unsafe {
from_glib_none(ffi::jsc_context_get_virtual_machine(
Expand All @@ -210,16 +206,20 @@ pub trait ContextExt: IsA<Context> + sealed::Sealed + 'static {
exception: *mut ffi::JSCException,
user_data: glib::ffi::gpointer,
) {
let context = from_glib_borrow(context);
let exception = from_glib_borrow(exception);
let callback: &P = &*(user_data as *mut _);
(*callback)(&context, &exception)
unsafe {
let context = from_glib_borrow(context);
let exception = from_glib_borrow(exception);
let callback = &*(user_data as *mut P);
(*callback)(&context, &exception)
}
}
let handler = Some(handler_func::<P> as _);
unsafe extern "C" fn destroy_notify_func<P: Fn(&Context, &Exception) + 'static>(
data: glib::ffi::gpointer,
) {
let _callback: Box_<P> = Box_::from_raw(data as *mut _);
unsafe {
let _callback = Box_::from_raw(data as *mut P);
}
}
let destroy_call3 = Some(destroy_notify_func::<P> as _);
let super_callback0: Box_<P> = handler_data;
Expand Down
1 change: 1 addition & 0 deletions src/auto/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
Expand Down
9 changes: 2 additions & 7 deletions src/auto/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::Context;
use crate::{ffi, Context};
use glib::{prelude::*, translate::*};

glib::wrapper! {
Expand Down Expand Up @@ -69,12 +69,7 @@ impl std::fmt::Display for Exception {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Exception>> Sealed for T {}
}

pub trait ExceptionExt: IsA<Exception> + sealed::Sealed + 'static {
pub trait ExceptionExt: IsA<Exception> + 'static {
#[doc(alias = "jsc_exception_get_backtrace_string")]
#[doc(alias = "get_backtrace_string")]
fn backtrace_string(&self) -> Option<glib::GString> {
Expand Down
1 change: 1 addition & 0 deletions src/auto/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::{bitflags::bitflags, translate::*};

bitflags! {
Expand Down
9 changes: 2 additions & 7 deletions src/auto/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#[cfg(feature = "v2_38")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_38")))]
use crate::TypedArrayType;
use crate::{Context, ValuePropertyFlags};
use crate::{ffi, Context, ValuePropertyFlags};
use glib::{prelude::*, translate::*};

glib::wrapper! {
Expand Down Expand Up @@ -190,12 +190,7 @@ impl ValueBuilder {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Value>> Sealed for T {}
}

pub trait ValueExt: IsA<Value> + sealed::Sealed + 'static {
pub trait ValueExt: IsA<Value> + 'static {
#[cfg(feature = "v2_38")]
#[cfg_attr(docsrs, doc(cfg(feature = "v2_38")))]
#[doc(alias = "jsc_value_array_buffer_get_size")]
Expand Down
2 changes: 1 addition & 1 deletion src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55)
Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f)
from gir-files (https://github.com/tauri-apps/gir-files @ 8be196040235)
1 change: 1 addition & 0 deletions src/auto/virtual_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
Expand Down
20 changes: 9 additions & 11 deletions src/auto/weak_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::Value;
use crate::{ffi, Value};
use glib::{
object::ObjectType as _,
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
Expand Down Expand Up @@ -72,12 +73,7 @@ impl WeakValueBuilder {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::WeakValue>> Sealed for T {}
}

pub trait WeakValueExt: IsA<WeakValue> + sealed::Sealed + 'static {
pub trait WeakValueExt: IsA<WeakValue> + 'static {
#[doc(alias = "jsc_weak_value_get_value")]
#[doc(alias = "get_value")]
fn value(&self) -> Option<Value> {
Expand All @@ -94,15 +90,17 @@ pub trait WeakValueExt: IsA<WeakValue> + sealed::Sealed + 'static {
this: *mut ffi::JSCWeakValue,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(WeakValue::from_glib_borrow(this).unsafe_cast_ref())
unsafe {
let f: &F = &*(f as *const F);
f(WeakValue::from_glib_borrow(this).unsafe_cast_ref())
}
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"cleared\0".as_ptr() as *const _,
Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
c"cleared".as_ptr(),
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
cleared_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// // Licensed under the MIT license, see the LICENSE file or <https://opensource.org/licenses/MIT>
#![cfg_attr(docsrs, feature(doc_cfg))]

use ffi;

mod auto;
pub use auto::{traits::*, *};

Expand Down
31 changes: 12 additions & 19 deletions sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
authors = [ "The Gtk-rs Project Developers" ]
authors = ["The Gtk-rs Project Developers"]
build = "build.rs"
description = "Sys functions for the Rust bindings of the javacriptcore library"
edition = "2021"
keywords = [ "javascript", "gtk-rs", "gnome" ]
keywords = ["javascript", "gtk-rs", "gnome"]
license = "MIT"
name = "javascriptcore-rs-sys"
repository = "https://github.com/tauri-apps/javascriptcore-rs"
Expand All @@ -13,38 +13,31 @@ version = "1.1.1"
name = "javascriptcoregtk-4.1"
version = "2.24"

[package.metadata.system-deps.javascriptcoregtk_4_1.v2_28]
version = "2.28"
[package.metadata.system-deps.javascriptcoregtk_4_1.v2_28]
version = "2.28"

[package.metadata.system-deps.javascriptcoregtk_4_1.v2_38]
version = "2.38"
[package.metadata.system-deps.javascriptcoregtk_4_1.v2_38]
version = "2.38"

[package.metadata.docs.rs]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition" ]
rustdoc-args = ["--generate-link-to-definition"]
all-features = true

[lib]
name = "javascriptcore_rs_sys"

[dependencies]
libc = "0.2"

[dependencies.glib]
package = "glib-sys"
version = "^0.22"

[dependencies.gobject]
package = "gobject-sys"
version = "^0.22"
glib-sys = "^0.22"
gobject-sys = "^0.22"

[build-dependencies]
system-deps = "6"
system-deps = "9"

[dev-dependencies]
shell-words = "1.0.0"
tempfile = "3"

[features]
v2_28 = [ ]
v2_38 = [ "v2_28" ]
v2_28 = []
v2_38 = ["v2_28"]
16 changes: 7 additions & 9 deletions sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55)
// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f)
// from ../gir-files (@ 8be196040235)
// DO NOT EDIT

#[cfg(not(docsrs))]
use std::process;

#[cfg(docsrs)]
fn main() {} // prevent linking libraries to avoid documentation failure

#[cfg(not(docsrs))]
fn main() {
if std::env::var("DOCS_RS").is_ok() {
// prevent linking libraries to avoid documentation failure
return;
}

if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={s}");
process::exit(1);
std::process::exit(1);
}
}
Loading