Skip to content

Commit a9f483d

Browse files
committed
docstring
1 parent 51472bc commit a9f483d

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/getsetall.jl

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
44
Extract all parts of `obj` that are selected by `optic`.
55
Returns a flat `Tuple` of values, or an `AbstractVector` if the selected parts contain arrays.
6-
This function is experimental and we might change the precise output container in future.
6+
7+
This function is experimental and we might change the precise output container in the future.
8+
9+
See also [`setall`](@ref).
710
811
912
```jldoctest
@@ -20,6 +23,34 @@ julia> getall(obj, @optic _ |> Elements() |> last)
2023
"""
2124
function getall end
2225

26+
"""
27+
setall(obj, optic, values)
28+
29+
Replace a part of `obj` that is selected by `optic` with `values`.
30+
The `values` collection should have the same number of elements as selected by `optic`.
31+
32+
This function is experimental and might change in the future.
33+
34+
See also [`getall`](@ref), [`set`](@ref).
35+
36+
```jldoctest
37+
julia> using Accessors
38+
39+
julia> obj = (a=1, b=(2, 3));
40+
41+
julia> optic = @optic _ |> Elements() |> last;
42+
43+
44+
# getall and setall are directly related to each other:
45+
julia> getall(obj, optic)
46+
(1, 3)
47+
48+
julia> setall(obj, optic, (4, 5))
49+
(a = 4, b = (2, 5))
50+
```
51+
"""
52+
function setall end
53+
2354
# implementations for individual noncomposite optics
2455

2556
getall(obj::Union{Tuple, AbstractVector}, ::Elements) = obj

0 commit comments

Comments
 (0)