Skip to content

Releases: h33p/cglue

v0.3.4

31 Jul 21:28
5384133
Compare
Choose a tag to compare

Changes in 0.3.4:

Stabilize task feature

Enable with task feature. Provides C equivalents for Waker, RawWaker, RawWakerVtable.

Trait alias within trait groups

Enables specifying different generic instantiations of the same trait in the same group. Example:

cglue_trait_group!(TestGroupGen, TT<u8>, { TT<usize> = TTUsize, TT<u64> = TTUSixtyFour });
cglue_impl_group!(SA, TestGroupGen, { TT<usize> = TTUsize });

Support traits with associated types

The following now compiles:

#[cglue_trait]
pub trait WithAssoc<T> {
	type AssocTy: Clone;

	fn with_assoc(&self, assoc: &Self::AssocTy) -> T;
}

Add Future support + Pin Self parameters

The following now works:

async fn hii() -> u64 {
    42
}

let obj = trait_obj!(hii() as Future);

assert_eq!(pollster::block_on(obj), 42);

Add futures Stream+Sink support

The following now works:

let items = [42, 43, 42];

let obj = trait_obj!(futures::stream::iter(items) as Stream);

assert_eq!(pollster::block_on(obj.collect::<Vec<_>>()), items);

Fix #17

Add Send bound to Opaquable for CBox to hack around a soundness issue

v0.2.12

16 Nov 23:30
626ef54
Compare
Choose a tag to compare

CGlue 0.2.11

20 Mar 22:31
cbb2536
Compare
Choose a tag to compare

CGlue 0.2.10

20 Feb 11:14
e6761fc
Compare
Choose a tag to compare

Changes in 0.2.10:

Rename Tup to CTup

Changes in 0.2.9 (yanked):

Add C tuples

Changes in 0.2.8:

Allow to provide custom implemenetations for generics functions

Re-export custom_impl macro.

Changes in 0.2.7:

Add more helpers to CVec

Parse different expressions in the cast macros

Expose CArcSome:

  • This is equivalent to Arc, and is essentially a pre-null-checked version of CArc.

CGlue 0.2.5

28 Dec 13:50
6f99749
Compare
Choose a tag to compare

Changes in 0.2.5:

fix no_std build.

CGlue 0.2.4

26 Dec 13:49
acef6ff
Compare
Choose a tag to compare

Changes in 0.2.4:

Make cglue generated exports easier to import:

  • cglue_##trait_or_groupname module is exposed as public that contains all types that are being re-exported to parent module.

  • In the future, these types may not be re-exported anymore, and code generator may rely on cglue_##trait_or_groupname to exist in scope for cleaner code generation.

Add boxed slice, CVec, and add more serde support.

Compatible with official abi_stable:

  • Users should now use cglue::trait_group::c_void as the c_void type.

  • Technically breaks semver, but it is not possible to do anything with c_void anyways.

Changes in 0.2.3:

Make formatting traits FFI-safe:

  • All standard fmt traits are exposed.

  • Only Debug and Display are in the prefix.

  • Not full formatting functionality is preserved across FFI boundary.

Add extra customization to C function impls.

CGlue 0.2.2

26 Nov 03:51
9456e84
Compare
Choose a tag to compare

Changes in 0.2.2:

Fix no_std compilation.

Remove 0.2.1. Don't ask.

CGlue 0.2.0

26 Nov 03:35
c214dd1
Compare
Choose a tag to compare

Changes in 0.2.0:

Rework code generation:

  • Make code generator emit C functions that take in a single object that contains both the object and the return context. This simplifies usage from C/C++.

  • Remove zero wrapper optimization. The above is incompatible with it.

  • Remove CtxBox, as context has been moved into the container object.

Context is now always Clone + Send + Sync.

Ergonomic C/C++ wrappers:

  • In C++ trait objects and groups have member functions and destructors defined. Trait objects and groups themselves are ABI-incompatible when passed by value.

  • In C there are inline functions for invoking behavior. Some of the functions accept void pointers, because they are compatible with multiple variations of the same CGlue object.

  • Ability to specify default container and context types, so that the wrappers become more compact.

  • Manual cleanup is no longer supported as bindgen has become more complex.

Somewhat tested with miri:

  • Stacked borrows are disabled.

  • ABI checks have been patched out, because otherwise rust evaluator does not accept type erasure.

Vtable-only functions:

  • Provide Rust functionality in C/C++ with slightly different types.

Wrap strings and slices in return types.

Unstable feature to auto-impl groups:

  • Auto-enables the widest set of optional traits for any given type.

  • Makes cglue_impl_group! a no-op.

Runtime ABI/API validation with abi_stable.

Remove no_empty_retwrap feature.

Replace CArc with COptArc, make old CArc private:

  • COptArc was always the prefered choice, as it allowed to also represent None in the same amount of space.