What
The Rust example in the "Configure a session limit" section of
docs/features/session-limits.md does not compile against the SDK it documents.
It calls SessionConfig::new(), but SessionConfig has no new associated
function -- it is constructed with SessionConfig::default() plus builder
methods. A reader who copies the snippet gets error[E0599].
Reproduce
Cargo.toml:
[dependencies]
github-copilot-sdk = "*"
tokio = { version = "1", features = ["full"] }
src/main.rs (the documented snippet, wrapped in the minimal main the guide implies):
use github_copilot_sdk::{
Client, ClientOptions, ResumeSessionConfig, SessionConfig, SessionLimitsConfig,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::start(ClientOptions::default()).await?;
let limits = SessionLimitsConfig { max_ai_credits: Some(30.0) };
let session = client
.create_session(
SessionConfig::new()
.approve_all_permissions()
.with_session_limits(limits.clone()),
)
.await?;
let resumed = client
.resume_session(
ResumeSessionConfig::new(session.id().clone())
.approve_all_permissions()
.with_session_limits(limits),
)
.await?;
let _ = resumed;
Ok(())
}
Run cargo build:
error[E0599]: no associated function or constant named `new` found for struct `SessionConfig` in the current scope
|
| SessionConfig::new()
| ^^^ associated function or constant not found in `SessionConfig`
Expected
The documented Rust snippet compiles against the SDK it ships with.
Actual
It fails to compile with the error[E0599] above at SessionConfig::new().
SessionConfig exposes Default (used throughout the crate) plus builder
methods; there is no SessionConfig::new. The sibling TypeScript, Go, Java, and
.NET tabs in the same section construct-then-configure, so the Rust tab is a
mistranslation. It went unnoticed because the block is marked
<!-- docs-validate: skip --> and Rust is not part of the doc-validation
language set, so CI never compiled it.
Environment
- github-copilot-sdk (Rust binding), current
main
- rustc/cargo 1.97
What
The Rust example in the "Configure a session limit" section of
docs/features/session-limits.mddoes not compile against the SDK it documents.It calls
SessionConfig::new(), butSessionConfighas nonewassociatedfunction -- it is constructed with
SessionConfig::default()plus buildermethods. A reader who copies the snippet gets
error[E0599].Reproduce
Cargo.toml:src/main.rs(the documented snippet, wrapped in the minimalmainthe guide implies):Run
cargo build:Expected
The documented Rust snippet compiles against the SDK it ships with.
Actual
It fails to compile with the
error[E0599]above atSessionConfig::new().SessionConfigexposesDefault(used throughout the crate) plus buildermethods; there is no
SessionConfig::new. The sibling TypeScript, Go, Java, and.NET tabs in the same section construct-then-configure, so the Rust tab is a
mistranslation. It went unnoticed because the block is marked
<!-- docs-validate: skip -->and Rust is not part of the doc-validationlanguage set, so CI never compiled it.
Environment
main