Skip to content

Do we really need to wrap Arc with Cow inside RoTxnInner? #350

@Logarithmus

Description

@Logarithmus

@Kerollmops

Cow in Rust is mainly used for strings. Arc is trivially cloneable on the other hand, so it makes no sense to have sometimes Arc, sometimes &Arc.

env: Cow<'e, Arc<EnvInner>>,

This Cow pollutes RoTxnInner, RoTxn and all other code using those structs with lifetimes.

I suggest changing this

struct RoTxnInner<'e> {
    /// Makes the struct covariant and !Sync
    pub(crate) txn: Option<NonNull<ffi::MDB_txn>>,
    env: Cow<'e, Arc<EnvInner>>,
}

to this

struct RoTxnInner {
    /// Makes the struct covariant and !Sync
    pub(crate) txn: Option<NonNull<ffi::MDB_txn>>,
    env: Arc<EnvInner>,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions