Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publicizing RedisKey member #245

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion examples/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static MY_REDIS_TYPE: RedisType = RedisType::new(
);

unsafe extern "C" fn free(value: *mut c_void) {
Box::from_raw(value.cast::<MyType>());
drop(Box::from_raw(value.cast::<MyType>()));
}

fn alloc_set(ctx: &Context, args: Vec<RedisString>) -> RedisResult {
Expand Down
2 changes: 1 addition & 1 deletion src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum KeyMode {
#[derive(Debug)]
pub struct RedisKey {
ctx: *mut raw::RedisModuleCtx,
key_inner: *mut raw::RedisModuleKey,
pub key_inner: *mut raw::RedisModuleKey,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we instead have a method to return it, rather than having it visible to everyone. Usually, such methods are called as_ptr and as_mut_ptr. I suggest we follow the conventional naming and leave this struct member private in favour of having a method.
I also didn't see where it was needed exactly and in what way. Perhaps, if there are examples of where it is needed, we could make it accessible in a more optimal way.

}

impl RedisKey {
Expand Down