Skip to content

Commit 213fad4

Browse files
context: add doc comments for ValueContext pub functions (#26541)
1 parent 92f9ead commit 213fad4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

vlib/context/value.v

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,33 @@ pub fn with_value(parent Context, key Key, value Any) Context {
3333
}
3434
}
3535

36+
// deadline returns the deadline from the parent context.
3637
pub fn (ctx &ValueContext) deadline() ?time.Time {
3738
return ctx.context.deadline()
3839
}
3940

41+
// done returns the done channel from the parent context.
4042
pub fn (mut ctx ValueContext) done() chan int {
4143
return ctx.context.done()
4244
}
4345

46+
// err returns the error from the parent context.
4447
pub fn (mut ctx ValueContext) err() IError {
4548
return ctx.context.err()
4649
}
4750

51+
// value returns the value associated with this context for the given key.
52+
// If the key matches the one stored in this ValueContext, its value is returned.
53+
// Otherwise, the lookup is delegated to the parent context.
4854
pub fn (ctx &ValueContext) value(key Key) ?Any {
4955
if ctx.key == key {
5056
return ctx.value
5157
}
5258
return ctx.context.value(key)
5359
}
5460

61+
// str returns a string representation of the ValueContext,
62+
// showing the parent context name suffixed with '.with_value'.
5563
pub fn (ctx &ValueContext) str() string {
5664
return context_name(ctx.context) + '.with_value'
5765
}

0 commit comments

Comments
 (0)