Skip to content

Mutating the state of immut references #5

@CXWorks

Description

@CXWorks

Hi,

In the following code, it will register the name and value into &self, which is an immut reference. Is it a violation of Rust's reference or designed behavior?

pub fn register_var(&self, name: String, value: String) {
let n = CString::new(name).unwrap();
let v = CString::new(value).unwrap();
unsafe {
ucl_parser_register_variable(self.parser, n.as_ptr(), v.as_ptr())
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions