Skip to content

Commit 930dc9a

Browse files
committed
allow pinning with not box
1 parent 818ec2b commit 930dc9a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llama-cpp-2/src/model/params.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ impl LlamaModelParams {
5454
///
5555
/// ```rust
5656
/// # use std::ffi::{CStr, CString};
57+
/// use std::pin::pin;
5758
/// # use llama_cpp_2::model::params::LlamaModelParams;
5859
/// # use llama_cpp_2::model::params::kv_overrides::ParamOverrideValue;
59-
/// let mut params = Box::pin(LlamaModelParams::default());
60+
/// let mut params = pin!(LlamaModelParams::default());
6061
/// let key = CString::new("key").expect("CString::new failed");
6162
/// params.append_kv_override(&key, ParamOverrideValue::Int(50));
6263
///
@@ -70,7 +71,7 @@ impl LlamaModelParams {
7071
/// ```
7172
#[allow(clippy::missing_panics_doc)] // panics are just to enforce internal invariants, not user errors
7273
pub fn append_kv_override(
73-
self: &mut Pin<Box<Self>>,
74+
self: &mut Pin<&mut Self>,
7475
key: &CStr,
7576
value: kv_overrides::ParamOverrideValue,
7677
) {

simple/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn main() -> Result<()> {
124124

125125
for (k, v) in key_value_overrides.iter() {
126126
let k = CString::new(k.as_bytes()).with_context(|| format!("invalid key: {}", k))?;
127-
model_params.append_kv_override(k.as_c_str(), *v);
127+
model_params.as_mut().append_kv_override(k.as_c_str(), *v);
128128
}
129129

130130
let model_path = model

0 commit comments

Comments
 (0)