pub enum CoreRequest {
Edit(EditCommand<EditRequest>),
NewView {
file_path: Option<String>,
},
GetConfig {
view_id: ViewId,
},
DebugGetContents {
view_id: ViewId,
},
}
Expand description
The requests which make up the base of the protocol.
All requests expect a response.
§Examples
The new_view
command:
extern crate serde_json;
use crate::xi_core::rpc::CoreRequest;
let json = r#"{
"method": "new_view",
"params": { "file_path": "~/my_very_fun_file.rs" }
}"#;
let cmd: CoreRequest = serde_json::from_str(&json).unwrap();
match cmd {
CoreRequest::NewView { .. } => (), // expected
other => panic!("Unexpected variant {:?}", other),
}
Variants§
Edit(EditCommand<EditRequest>)
The ‘edit’ namespace, for view-specific requests.
NewView
Tells xi-core
to create a new view. If the file_path
argument is present, xi-core
should attempt to open the file
at that location.
Returns the view identifier that should be used to interact with the newly created view.
GetConfig
Returns the current collated config object for the given view.
DebugGetContents
Returns the contents of the buffer for a given ViewId
.
In the future this might also be used to return structured data (such
as for printing).
Trait Implementations§
Source§impl Debug for CoreRequest
impl Debug for CoreRequest
Source§impl<'de> Deserialize<'de> for CoreRequest
impl<'de> Deserialize<'de> for CoreRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CoreRequest
impl PartialEq for CoreRequest
Source§impl Serialize for CoreRequest
impl Serialize for CoreRequest
impl StructuralPartialEq for CoreRequest
Auto Trait Implementations§
impl Freeze for CoreRequest
impl RefUnwindSafe for CoreRequest
impl Send for CoreRequest
impl Sync for CoreRequest
impl Unpin for CoreRequest
impl UnwindSafe for CoreRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more