mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-29 16:27:55 +00:00
Make the recommended changed from code review.
This commit is contained in:
@@ -23,14 +23,16 @@ pub struct Ctxt {
|
||||
}
|
||||
|
||||
impl Ctxt {
|
||||
/// Create a new context object
|
||||
/// Create a new context object.
|
||||
///
|
||||
/// This object contains no errors, but will still trigger a panic if it is not `check`ed.
|
||||
pub fn new() -> Self {
|
||||
Ctxt {
|
||||
errors: RefCell::new(Some(Vec::new())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Add an error to the context object
|
||||
/// Add an error to the context object.
|
||||
pub fn error<T: Display>(&self, msg: T) {
|
||||
self.errors
|
||||
.borrow_mut()
|
||||
|
||||
Reference in New Issue
Block a user