Skip to content

Commit 9bd3f07

Browse files
committed
docstring
1 parent 51472bc commit 9bd3f07

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/getsetall.jl

Lines changed: 30 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,32 @@ 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). The former is dual to `setall`:
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+
julia> getall(obj, optic)
44+
(1, 3)
45+
46+
julia> setall(obj, optic, (4, 5))
47+
(a = 4, b = (2, 5))
48+
```
49+
"""
50+
function setall end
51+
2352
# implementations for individual noncomposite optics
2453

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

0 commit comments

Comments
 (0)