mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 10:05:54 +02:00
Rename Value::CustomValue
to Value::Custom
(#12309)
# Description The second `Value` is redundant and will consume five extra bytes on each transmission of a custom value to/from a plugin. # User-Facing Changes This is a breaking change to the plugin protocol. The [example in the protocol reference](https://www.nushell.sh/contributor-book/plugin_protocol_reference.html#value) becomes ```json { "Custom": { "val": { "type": "PluginCustomValue", "name": "database", "data": [36, 190, 127, 40, 12, 3, 46, 83], "notify_on_drop": true }, "span": { "start": 320, "end": 340 } } } ``` instead of ```json { "CustomValue": { ... } } ``` # After Submitting Update plugin protocol reference
This commit is contained in:
committed by
GitHub
parent
dfbbacfdf8
commit
b19da158d5
@ -69,7 +69,7 @@ impl SQLiteDatabase {
|
||||
pub fn try_from_value(value: Value) -> Result<Self, ShellError> {
|
||||
let span = value.span();
|
||||
match value {
|
||||
Value::CustomValue { val, .. } => match val.as_any().downcast_ref::<Self>() {
|
||||
Value::Custom { val, .. } => match val.as_any().downcast_ref::<Self>() {
|
||||
Some(db) => Ok(Self {
|
||||
path: db.path.clone(),
|
||||
ctrlc: db.ctrlc.clone(),
|
||||
@ -97,7 +97,7 @@ impl SQLiteDatabase {
|
||||
|
||||
pub fn into_value(self, span: Span) -> Value {
|
||||
let db = Box::new(self);
|
||||
Value::custom_value(db, span)
|
||||
Value::custom(db, span)
|
||||
}
|
||||
|
||||
pub fn query(
|
||||
@ -357,7 +357,7 @@ impl CustomValue for SQLiteDatabase {
|
||||
ctrlc: self.ctrlc.clone(),
|
||||
};
|
||||
|
||||
Value::custom_value(Box::new(cloned), span)
|
||||
Value::custom(Box::new(cloned), span)
|
||||
}
|
||||
|
||||
fn type_name(&self) -> String {
|
||||
|
Reference in New Issue
Block a user