Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6589589

Browse files
xamgoresunli829
authored andcommitted
Document extension context fields
Custom extensions may require modifications to context fields.To avoid mistakes, it’s important to understand their connectionto the request lifecycle—specifically when, where, and how each fieldis created, modified, and dropped.These comments aim to clarify that lifecycle and usage context.
1 parent57ed375 commit6589589

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎src/extensions/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,24 @@ use crate::{
3737

3838
/// Context for extension
3939
pubstructExtensionContext<'a>{
40-
#[doc(hidden)]
40+
/// Schema-scope context data, [`Registry`], and custom directives.
4141
pubschema_env:&'aSchemaEnv,
4242

43-
#[doc(hidden)]
43+
/// Extension-scoped context data shared across all extensions.
44+
///
45+
/// Can be accessed only from hooks that implement the [`Extension`] trait.
46+
///
47+
/// It is created with each new [`Request`] and is empty by default.
48+
///
49+
/// For subscriptions, the session ends when the subscription is closed.
4450
pubsession_data:&'aData,
4551

46-
#[doc(hidden)]
52+
/// Request-scoped context data shared across all resolvers.
53+
///
54+
/// This is a reference to [`Request::data`](Request) field.
55+
/// If the request has not initialized yet, the value is seen as `None`
56+
/// inside the [`Extension::request`], [`Extension::subscribe`], and
57+
/// [`Extension::prepare_request`] hooks.
4758
pubquery_data:Option<&'aData>,
4859
}
4960

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp