File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -86,9 +86,22 @@ mod foo {
86
86
This convention avoids stuttering (like ` io::IoError ` ). Library clients can
87
87
rename on import to avoid clashes.
88
88
89
- ### Getter/setter methods [ FIXME ]
89
+ ### Getter/setter methods [ RFC 344 ]
90
90
91
- > ** [ FIXME] ** Need a naming and signature convention here.
91
+ > The guidelines below were approved by [ RFC #344 ] ( https://github.com/rust-lang/rfcs/pull/344 ) .
92
+
93
+ Some data structures do not wish to provide direct access to their fields, but
94
+ instead offer "getter" and "setter" methods for manipulating the field state
95
+ (often providing checking or other functionality).
96
+
97
+ The convention for a field ` foo: T ` is:
98
+
99
+ * A method ` foo(&self) -> &T ` for getting the current value of the field.
100
+ * A method ` set_foo(&self, val: T) ` for setting the field. (The ` val ` argument
101
+ here may take ` &T ` or some other type, depending on the context.)
102
+
103
+ Note that this convention is about getters/setters on ordinary data types, * not*
104
+ on [ builder objects] ( ../ownership/builders.html ) .
92
105
93
106
### Escape hatches [ FIXME]
94
107
You can’t perform that action at this time.
0 commit comments