-
Notifications
You must be signed in to change notification settings - Fork 4
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
Setting new_enforcer
function
#13
Comments
@hsluoyz @hackerchai @PsiACE please help |
I tried to send the adapter as wrapped under
In this first approach, I think we will loose the optimisation and hence was planning to go with the second one. @hsluoyz @hackerchai is it fine if I make some changes in Until then I will try to close the other issues in sqlx-adapter and casbin-actix-auth Update: sqlx adapter issue has been resolved |
@hackerchai @hsluoyz can you please comment on above issue and give your views. I have tried every possible thing I could think of, adapter doesn’t have clone or copy traits implemented, hence can’t directly copy it without taking reference. |
@SiddheshKanawade plz contact @hackerchai |
Will dm him too, it seems he isn’t active over here recently. Till then I am working on diesel adapter #66 |
I am trying to draft the
new_enforcer
, which is as below:Here I am getting error in
self.get_adapter()
andself.add_enforcer()
function, the error message is as follows:After the initial research I was able to figure out that this is due to the & reference from the
get_adapter
function, which is as below:Here,
adapter_map
is a hashmap:When we take any value from the hashmap, we get the reference of that value rather than the copy of the value. In short, when we do
self.adapter_map.get(&handle)
, we get&Box<dyn Adapter>
and notBox<dyn Adapter>
. Since Copy trait is not implemented for Adapter in thecasbin-rs
, we can't use methods liketo_owned
to drop the&
.I tried to send the
Box<dyn Adapter>
wrapped inArc<Mutex<Box<dyn Adapter>>>
but then inconvert.rs
of casbin-rs we can't call TryIntoAdapter for it.I am unable to figure out how can I resolve the above errors.
The text was updated successfully, but these errors were encountered: