1 % Output from functions and methods
3 ### Don't overpromise. [FIXME]
5 > **[FIXME]** Add discussion of overly-specific return types,
6 > e.g. returning a compound iterator type rather than hiding it behind
9 ### Let clients choose what to throw away. [FIXME: needs RFC]
11 #### Return useful intermediate results:
13 Many functions that answer a question also compute interesting related data. If
14 this data is potentially of interest to the client, consider exposing it in the
21 found: bool, // item in container?
22 expected_index: uint // what would the item's index be?
25 fn binary_search(&self, k: Key) -> SearchResult
30 fn binary_search(&self, k: Key) -> (bool, uint)
36 fn binary_search(&self, k: Key) -> bool
39 #### Yield back ownership:
44 fn from_utf8_owned(vv: Vec<u8>) -> Result<String, Vec<u8>>
50 fn from_utf8_owned(vv: Vec<u8>) -> Option<String>
53 The `from_utf8_owned` function gains ownership of a vector. In the successful
54 case, the function consumes its input, returning an owned string without
55 allocating or copying. In the unsuccessful case, however, the function returns
56 back ownership of the original slice.