Code Monkey home page Code Monkey logo

archery's People

Contributors

attackgoat avatar dependabot[bot] avatar michaelsproul avatar orium avatar yvt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

archery's Issues

Add serde support

Title pretty much sums it up: it would be nice to be able to #[derive(Serialize, Deserialize)] on types containing SharedPointer.

`SharedPointer<T, P>: {Send,Sync}` should require `T: Send + Sync`

The following program should fail to compile, but it doesn't and crashes at runtime:

use std::cell::Cell;

type Arc<T> = archery::SharedPointer<T, archery::ArcK>;

fn main() {
    let cell = Arc::new(Cell::new(None));

    let jhs = [(); 2].map(|()| {
        let cell = Arc::clone(&cell);
        std::thread::spawn(move || loop {
            // concurrent access of a `!Sync` cell from multiple threads
            cell.take();
            cell.set(Some(Box::new(42)));
        })
    });

    for jh in jhs {
        jh.join().unwrap();
    }
}
$ cargo run --release --quiet
free(): unaligned chunk detected in tcache 2
fish: Job 1, 'cargo run --release' terminated by signal SIGABRT (Abort)

Support weak pointers

Thanks for your work on this crate!

Are there any plans to support Weak pointers?

Auto-derived `Clone` for something using `RcPointer` is unusable

Issue created for future reference.

This is a rustc issue in the way Clone is derived.

The problem is that

#[derive(Clone)] 
struct AThing<T, C: RcPointerKind> {
    field: RcPointer<C, T>,
}

expands to

impl<T: Clone, C: Clone + RcPointerKind> Clone for AThing<T, C> { ... }

which requires C to implement Clone. In practice it should only require the type of AThing::field to be implement Clone. See rust-lang/rust#26925 (comment) for details.

add `Clone` to `SharedPointerKind`'s constraints

I don't yet know enough to be able to determine whether this would break invariants that must be upheld.

Would it be possible & feasible to do this so that RcK & ArcK impl Clone?

I have a type (Value) and would like to derive/impl Clone for it:

pub enum Value<P: archery::SharedPointerKind> {
    Map(Map<P>),
}


#[derive(Debug, Clone)]
pub struct Map<P: SharedPointerKind>(pub(crate) RawMap<P>);

pub type RawMap<P> = rpds::HashTrieMap<Value<P>, Value<P>, P>;

To do so and actually make use of it like so, I have to add + Clone to all of my P: archery::SharedPointerKinds which results in an error because RcK & ArcK are not Clone.

Thank you for the excellent library!

Tests fail in release profile

Running the tests with release currently fails, i.e.

cargo test --release

Part of the reason is that the compile-fail tests hardcode debug into the path here:

config.target_rustcflags = Some(rustc_flags("target/debug/deps/", &dependencies));

However even when I fixed that path I still got weird failures. Perhaps we could slap a #![cfg(debug_assertions)] on the compile-fail tests?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.