Skip to content

Commit ba9faa0

Browse files
committed
Polish a few new docstrings.
Replace the slightly stiff "Get an item from a database, decoded as T" phrasing on `get` with "Read the value at `key`, decoded as T", and swap "whether or not f throws" on `Environment(f, path)` for the plainer "even if f throws".
1 parent 2a9bd84 commit ba9faa0

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/database.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ end
155155
"""
156156
get(txn::Transaction, dbi::Database, key, ::Type{T}) -> T
157157
158-
Get an item from a database, decoded as `T`. Throws `LMDBError` if
159-
`key` is not present. Analogous to `getindex(d, k)` on a regular
160-
`AbstractDict`.
158+
Read the value at `key`, decoded as `T`. Throws `LMDBError` if `key`
159+
isn't there — the same shape as `d[k]` on a regular `AbstractDict`.
161160
"""
162161
@inline function get(txn::Transaction, dbi::Database, key, ::Type{T}) where T
163162
val_ref = Ref(MDBValue())
@@ -168,9 +167,9 @@ end
168167
"""
169168
get(txn::Transaction, dbi::Database, key, ::Type{T}, default) -> Union{T,typeof(default)}
170169
171-
Get an item from a database, returning `default` if `key` is not
172-
present. Mirrors `Base.get(dict, key, default)`. For the
173-
`Union{T,Nothing}` shape, pass `nothing` as `default`.
170+
Read the value at `key`, decoded as `T`; return `default` if the key
171+
isn't there. Same shape as `Base.get(dict, key, default)`. Pass
172+
`nothing` as `default` for the `Union{T,Nothing}` form.
174173
"""
175174
@inline function get(txn::Transaction, dbi::Database, key, ::Type{T}, default) where T
176175
val_ref = Ref(MDBValue())

src/environment.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ end
6363
"""
6464
Environment(f::Function, path::AbstractString; kwargs...) -> result
6565
66-
`do`-block form. Opens the env, runs `f(env)`, and closes it on the
67-
way out whether or not `f` throws. Returns whatever `f` returns.
66+
`do`-block form. Opens the env, runs `f(env)`, closes it on the way
67+
out — even if `f` throws. Returns whatever `f` returns.
6868
"""
6969
function Environment(f::Function, path::AbstractString; kwargs...)
7070
env = Environment(path; kwargs...)

0 commit comments

Comments
 (0)