Skip to content

Conversation

@therustmonk
Copy link
Contributor

@therustmonk therustmonk commented Mar 3, 2017

Current push declaration is:

impl State {
    fn push<T: ToLua>(&mut self, value: T)
}

But ToLua satisfied with the reference &self (it doesn't need to own the instance).

trait ToLua {
    fn to_lua(&self, state: &mut State)
}

I don't see any reason to own the value inside push.
But owning makes hard to push nested structs with this generic push method, because we have convert nested items to owned (clone) to satisfy push declaration.

This PR makes tiny backward-incompatible change and uses reference only to push objects ToLua.

impl State {
    fn push<T: ToLua>(&mut self, value: &T)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant