From 5697183918669e5fe41f4411e684dab53c1af612 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 29 Jan 2022 13:32:31 +0100 Subject: [PATCH] Rename from_string to set_from_string To make it a bit more obvious at a glance that this mutates the parameter. --- src/params.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/params.rs b/src/params.rs index 0a978940..05cd27db 100644 --- a/src/params.rs +++ b/src/params.rs @@ -69,7 +69,7 @@ macro_rules! impl_plainparam { /// can fail if the string cannot be parsed. /// /// TODO: After implementing VST3, check if we handle parsing failures correctly - pub fn from_string(&mut self, string: &str) -> bool { + pub fn set_from_string(&mut self, string: &str) -> bool { let value = match &self.string_to_value { Some(f) => f(string), // TODO: Check how Rust's parse function handles trailing garbage @@ -240,10 +240,10 @@ impl ParamPtr { /// /// Calling this function is only safe as long as the object this `ParamPtr` was created for is /// still alive. - pub unsafe fn from_string(&mut self, string: &str) -> bool { + pub unsafe fn set_from_string(&mut self, string: &str) -> bool { match &self { - ParamPtr::FloatParam(p) => (**p).from_string(string), - ParamPtr::IntParam(p) => (**p).from_string(string), + ParamPtr::FloatParam(p) => (**p).set_from_string(string), + ParamPtr::IntParam(p) => (**p).set_from_string(string), } }