id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_519200 | rust_dataset.txt | 519,200 | 512 | "##;
let document: KdlDocument = fake_config.parse().unwrap();
let sourced_from_external_file = false;
let deserialized =
Themes::from_kdl(document.get("themes").unwrap(), sourced_from_external_file).unwrap();
let serialized = Themes::to_kdl(&deserialized).unwrap();
let deserialized_from_ser... |
rust_dataset_chunk_519201 | rust_dataset.txt | 519,201 | 512 | _config.parse().unwrap();
let sourced_from_external_file = false;
let deserialized =
Themes::from_kdl(document.get("themes").unwrap(), sourced_from_external_file).unwrap();
let serialized = Themes::to_kdl(&deserialized).unwrap();
let deserialized_from_serialized = Themes::from_kdl(
seria... |
rust_dataset_chunk_519202 | rust_dataset.txt | 519,202 | 512 | _serialized,
"Deserialized serialized config equals original config"
);
insta::assert_snapshot!(serialized.to_string());
}
#[test]
fn themes_to_string_with_terminal_colors() {
let fake_config = r##"
themes {
dracula {
fg 248 248 242
bg 40 42 54
... |
rust_dataset_chunk_519203 | rust_dataset.txt | 519,203 | 512 | let deserialized_from_serialized = PluginAliases::from_kdl(
serialized
.to_string()
.parse::<KdlDocument>()
.unwrap()
.get("plugins")
.unwrap(),
)
.unwrap();
assert_eq!(
deserialized, deserialized_from_serialized,
"Deser... |
rust_dataset_chunk_519204 | rust_dataset.txt | 519,204 | 512 | border_top "double"
floating_border_style "heavy"
floating_border_rounded_corners false
}
}"##;
let document: KdlDocument = fake_config.parse().unwrap();
let deserialized = UiConfig::from_kdl(document.get("ui").unwrap()).unwrap();
assert_eq!(
dese... |
rust_dataset_chunk_519205 | rust_dataset.txt | 519,205 | 512 | () {
let fake_config = r##"
env {
foo "bar"
bar "foo"
thing 1
baz "true"
}"##;
let document: KdlDocument = fake_config.parse().unwrap();
let deserialized = EnvironmentVariables::from_kdl(document.get("env").unwrap()).unwrap();
let serialize... |
rust_dataset_chunk_519206 | rust_dataset.txt | 519,206 | 512 | reparsed = Config::from_kdl(&serialized.to_string(), None).unwrap();
assert_eq!(config.session_suggestions, reparsed.session_suggestions);
insta::assert_snapshot!(serialized.to_string());
}
#[test]
fn env_vars_to_string_with_no_env_vars() {
let fake_config = r##"
env {
}"##;
let docume... |
rust_dataset_chunk_519207 | rust_dataset.txt | 519,207 | 512 | (true));
}
#[test]
fn context_menu_enabled_has_a_command_line_flag() {
use clap::Parser;
#[derive(Parser)]
struct OptionsCli {
#[clap(flatten)]
options: Options,
}
let parsed = OptionsCli::try_parse_from(["zellij", "--context-menu-enabled", "false"]).unwrap();
assert_eq!(parsed.... |
rust_dataset_chunk_519208 | rust_dataset.txt | 519,208 | 512 | document).unwrap();
assert_eq!(deserialized.explicit_theme_hue, Some(ThemeHue::Light));
let empty_document: KdlDocument = "".parse().unwrap();
let deserialized_empty = Options::from_kdl(&empty_document).unwrap();
assert_eq!(
deserialized_empty.explicit_theme_hue, None,
"an unspecified e... |
rust_dataset_chunk_519209 | rust_dataset.txt | 519,209 | 512 | Document::new();
fake_document.nodes_mut().append(&mut serialized);
let deserialized_from_serialized =
Options::from_kdl(&fake_document.to_string().parse::<KdlDocument>().unwrap()).unwrap();
assert_eq!(
deserialized_from_serialized.dangerously_allow_web_serving_without_a_... |
rust_dataset_chunk_519210 | rust_dataset.txt | 519,210 | 512 | fake_config = r##"
simplified_ui true
theme "dracula"
default_mode "locked"
default_shell "fish"
default_cwd "/tmp/foo"
default_layout "compact"
layout_dir "/tmp/layouts"
theme_dir "/tmp/themes"
mouse_mode false
pane_frames false
m... |
rust_dataset_chunk_519211 | rust_dataset.txt | 519,211 | 512 | {
use crate::input::options::NestedSessionHandling;
let cases = [
("ask", NestedSessionHandling::Ask),
("fullscreen", NestedSessionHandling::Fullscreen),
("descend", NestedSessionHandling::Descend),
("never", NestedSessionHandling::Never),
];
for (value, expected) in cas... |
rust_dataset_chunk_519212 | rust_dataset.txt | 519,212 | 512 | _config = r##"
host_notification_protocol "carrier-pigeon"
"##;
let document: KdlDocument = fake_config.parse().unwrap();
assert!(Options::from_kdl(&document).is_err());
}
#[test]
fn an_unset_host_notification_protocol_parses_as_none() {
let document: KdlDocument = r##"
simplified_ui tr... |
rust_dataset_chunk_519213 | rust_dataset.txt | 519,213 | 512 | _stringified);
}
#[test]
fn osc8_hyperlinks_config_parsing() {
let config_with_osc8_disabled = r#"
osc8_hyperlinks false
"#;
let config = Config::from_kdl(config_with_osc8_disabled, None).unwrap();
assert_eq!(config.options.osc8_hyperlinks, Some(false));
let config_with_osc8_enabled = r#"
... |
rust_dataset_chunk_519214 | rust_dataset.txt | 519,214 | 512 | ane, Some(true));
}
#[cfg(test)]
fn context_menu_from(
config: &str,
base: ContextMenuConfig,
) -> Result<ContextMenuConfig, ConfigError> {
let document: KdlDocument = config.parse().unwrap();
ContextMenuConfig::from_kdl(
document.get("context_menu").unwrap(),
base,
&Options::de... |
rust_dataset_chunk_519215 | rust_dataset.txt | 519,215 | 512 | }
item "e" { StartRenamePaneByPaneId; }
item "f" { NewFloatingPane; }
}
tab {
item "g" { MoveTabByTabId "left"; }
item "h" { MoveTabByTabId "right" 4; }
item "i" { StartRenameTabByTabId; }
item "j" {... |
rust_dataset_chunk_519216 | rust_dataset.txt | 519,216 | 512 | TogglePanePinnedByPaneId",
"TogglePaneInGroupByPaneId",
"StartRenamePaneByPaneId",
"CloseTabById",
"StartRenameTabByTabId",
"MoveTabByTabId \"left\"",
"MoveTabByTabId \"right\"",
"CloseFocusByPaneId \"terminal_2\"",
"MoveTabByTabId \"left\" 3",
"Mo... |
rust_dataset_chunk_519217 | rust_dataset.txt | 519,217 | 512 | {
let document: KdlDocument = text.parse().unwrap();
let node = document.nodes().first().unwrap();
assert_eq!(
ContextMenuAction::from_kdl(node, &Options::default()).unwrap(),
expected,
"{}",
text
);
}
for bad in [
"MoveTab... |
rust_dataset_chunk_519218 | rust_dataset.txt | 519,218 | 512 | .tab, context_menu_base().tab);
assert_eq!(context_menu.common, context_menu_base().common);
}
#[test]
fn context_menu_clear_defaults_for_whole_block() {
let context_menu = context_menu_from(
r#"
context_menu clear-defaults=true {
bar {
item "Clear" { Clear; }
... |
rust_dataset_chunk_519219 | rust_dataset.txt | 519,219 | 512 | _menu.to_kdl().unwrap().to_string();
let reparsed = context_menu_from(&serialized, default_context_menu()).unwrap();
assert_eq!(context_menu, reparsed);
}
#[cfg(test)]
fn default_context_menu() -> ContextMenuConfig {
crate::input::config_settings::default_config()
.context_menu
.clone()
}
... |
rust_dataset_chunk_519220 | rust_dataset.txt | 519,220 | 512 | pane"
item "Top" before="Missing" { Detach; }
}
tab {
item "First" before="Close tab" { Detach; }
}
}"#,
context_menu_base(),
)
.unwrap();
assert_eq!(
context_menu.pane,
vec![
ContextMenuEntry::S... |
rust_dataset_chunk_519221 | rust_dataset.txt | 519,221 | 512 | MenuEntry::item("A", vec![Action::Detach.into()]),
ContextMenuEntry::item("A", vec![Action::Detach.into()]),
ContextMenuEntry::Separator,
]
);
}
#[test]
fn an_empty_context_menu_is_written_with_empty_sections() {
let serialized = ContextMenuConfig::default().to_kdl().unwrap().to... |
rust_dataset_chunk_519222 | rust_dataset.txt | 519,222 | 512 | !(!config.context_menu.tab.is_empty());
assert!(!config.context_menu.bar.is_empty());
assert!(!config.context_menu.common.is_empty());
let serialized = config.to_string(false);
let reparsed =
Config::from_kdl(&serialized, Some(Config::from_default_assets().unwrap())).unwrap();
assert_eq!(con... |
rust_dataset_chunk_519223 | rust_dataset.txt | 519,223 | 512 | _hidden_on_start,
Some(HiddenBars::from_names(&["tab-bar", "status-bar"]))
);
assert_eq!(options.hidden_bars_notification, Some(false));
assert_eq!(options.mode_hints_when_bars_hidden, Some(false));
let mut serialized = Options::to_kdl(&options, false);
let mut fake_document = KdlDocument::n... |
rust_dataset_chunk_519224 | rust_dataset.txt | 519,224 | 512 | }])
);
assert_eq!(action_for("Alt d"), Some(vec![Action::ShowBars]));
assert_eq!(
action_for("Alt e"),
Some(vec![Action::HideBarByPaneId {
pane_id: PaneId::Plugin(3)
}])
);
for action in [
Action::ToggleBars { bars: vec![] },
Action::Toggle... |
rust_dataset_chunk_519225 | rust_dataset.txt | 519,225 | 512 | wasm"))]
pub mod app_control;
#[cfg(not(target_family = "wasm"))]
pub mod channels; // Requires tokio
#[cfg(not(target_family = "wasm"))]
pub mod common_path;
#[cfg(not(target_family = "wasm"))]
pub mod downloader; // Requires tokio
#[cfg(not(target_family = "wasm"))]
pub mod ipc; // Requires interprocess
#[cfg(not(tar... |
rust_dataset_chunk_519226 | rust_dataset.txt | 519,226 | 512 | 16; // 16 MiB per log
pub fn configure_logger() {
atomic_create_dir(&*ZELLIJ_TMP_DIR).unwrap();
atomic_create_dir(&*ZELLIJ_TMP_LOG_DIR).unwrap();
atomic_create_file(&*ZELLIJ_TMP_LOG_FILE).unwrap();
let trigger = SizeTrigger::new(LOG_MAX_BYTES);
let roller = FixedWindowRoller::builder()
.bu... |
rust_dataset_chunk_519227 | rust_dataset.txt | 519,227 | 512 | output from plugins
let config = Config::builder()
.appender(Appender::builder().build("logFile", Box::new(log_file)))
.appender(Appender::builder().build("logPlugin", Box::new(log_plugin)))
// reduce the verbosity of isahc, otherwise it logs on every failed web request
.logger(
... |
rust_dataset_chunk_519228 | rust_dataset.txt | 519,228 | 512 | ested_session_contract/mod.rs ---
include!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/assets/prost_nested_session/generated_nested_session_api.rs"
));
--- FILE: zellij/zellij-utils/src/nested_session.rs ---
use crate::data::{
BareKey, Direction, InputMode, KeyWithModifier, KeybindsVec, NestedSessionKeybinds,
... |
rust_dataset_chunk_519229 | rust_dataset.txt | 519,229 | 512 | ED_REANNOUNCE_CHECK_INTERVAL_MS")
.ok()
.and_then(|value| value.parse().ok())
.unwrap_or(REANNOUNCE_CHECK_INTERVAL_MS)
}
pub fn max_unacked_announces() -> usize {
std::env::var("ZELLIJ_NESTED_MAX_UNACKED_ANNOUNCES")
.ok()
.and_then(|value| value.parse().ok())
.unwrap... |
rust_dataset_chunk_519230 | rust_dataset.txt | 519,230 | 512 | <Direction>,
},
ToggleHostFullscreen {
fullscreen: bool,
},
Pong,
Bye,
AnnounceAck {
ancestry: Vec<String>,
capabilities: Vec<NestedSessionCapability>,
descend_keys: Vec<KeyWithModifier>,
},
FocusGained {
from_direction: Option<Direction>,
},
... |
rust_dataset_chunk_519231 | rust_dataset.txt | 519,231 | 512 | is written to the wire under the name [`InputMode::from_str`] reads,
/// so that a mode one side does not know about is rejected rather than misread, and so
/// that adding a mode needs no change to this contract.
fn mode_to_proto(mode: InputMode) -> String {
format!("{:?}", mode)
}
fn mode_from_proto(mode: &str)... |
rust_dataset_chunk_519232 | rust_dataset.txt | 519,232 | 512 | BareKey::Char(character) if character.is_control())
}
fn keybinds_error_to_proto(error: NestedSessionKeybindsError) -> proto::GuestKeybindsError {
match error {
NestedSessionKeybindsError::NotANestedSession => proto::GuestKeybindsError::NotNested,
NestedSessionKeybindsError::NotSupported => proto:... |
rust_dataset_chunk_519233 | rust_dataset.txt | 519,233 | 512 | _proto(direction: i32) -> Option<Direction> {
match proto::NestedDirection::try_from(direction).ok() {
Some(proto::NestedDirection::Left) => Some(Direction::Left),
Some(proto::NestedDirection::Right) => Some(Direction::Right),
Some(proto::NestedDirection::Up) => Some(Direction::Up),
... |
rust_dataset_chunk_519234 | rust_dataset.txt | 519,234 | 512 | }),
NestedSessionMessage::GuestModeUpdate {
mode,
base_mode,
session_path,
keybinds_generation,
} => Payload::GuestModeUpdate(proto::GuestModeUpdate {
mode: mode_to_proto(mode),
base_mode: base_mode.... |
rust_dataset_chunk_519235 | rust_dataset.txt | 519,235 | 512 | (Payload::Pong(_)) => Ok(NestedSessionMessage::Pong),
Some(Payload::Bye(_)) => Ok(NestedSessionMessage::Bye),
Some(Payload::AnnounceAck(announce_ack)) => Ok(NestedSessionMessage::AnnounceAck {
ancestry: announce_ack.ancestry,
capabilities: capabilities_from_proto(... |
rust_dataset_chunk_519236 | rust_dataset.txt | 519,236 | 512 | base_mode: base_mode_from_proto(&guest_keybinds.base_mode),
keybinds: keybinds_from_proto(&guest_keybinds.keybinds_payload).ok_or(())?,
session_path: guest_keybinds.session_path,
keybinds_generation: guest_keybinds.keybinds_generation,
... |
rust_dataset_chunk_519237 | rust_dataset.txt | 519,237 | 512 | SessionMessage::GuestKeybindsReply {
request_id,
result: Err(NestedSessionKeybindsError::TooLarge),
})
} else {
payload
}
}
enum FrameScanStatus {
Complete(usize),
NeedMore,
Diverged,
}
fn frame_scan_status(buf: &[u8]) -> FrameScanStatus {
if buf.len() <... |
rust_dataset_chunk_519238 | rust_dataset.txt | 519,238 | 512 | _payloads.push(payload);
}
i += len;
continue;
},
FrameScanStatus::NeedMore => {
let tail = rest.to_vec();
if tail.len() > MAX_PARTIAL_FRAME_BYTES {
... |
rust_dataset_chunk_519239 | rust_dataset.txt | 519,239 | 512 | Key::Char('o')).with_ctrl_modifier(),
KeyWithModifier::new(BareKey::Up),
],
descend_keys: vec![],
},
NestedSessionMessage::GuestModeUpdate {
mode: InputMode::Locked,
base_mode: Some(InputMode::Normal),
... |
rust_dataset_chunk_519240 | rust_dataset.txt | 519,240 | 512 | message in all_message_arms() {
let decoded = decode_payload(&encode_payload(&message));
assert_eq!(decoded, Some(message));
}
}
#[test]
fn focus_direction_roundtrip_preserves_every_direction() {
let directions = [
None,
Some(Direction::Left)... |
rust_dataset_chunk_519241 | rust_dataset.txt | 519,241 | 512 | _is_dropped() {
let capabilities = capabilities_from_proto(&[
proto::NestedCapability::HintReporting as i32,
9999,
proto::NestedCapability::NestedControl as i32,
]);
assert_eq!(
capabilities,
vec![
NestedSessionCapabilit... |
rust_dataset_chunk_519242 | rust_dataset.txt | 519,242 | 512 | _survive_the_roundtrip() {
let message = keybinds_reply(5, vec![]);
assert_eq!(decode_payload(&encode_payload(&message)), Some(message));
}
#[test]
fn every_keybinds_error_survives_the_roundtrip() {
for error in [
NestedSessionKeybindsError::NotANestedSession,
... |
rust_dataset_chunk_519243 | rust_dataset.txt | 519,243 | 512 | _payload(&keybinds_reply(1, keybinds)));
let Some(NestedSessionMessage::GuestKeybindsReply {
result: Ok(NestedSessionKeybinds {
keybinds: decoded, ..
}),
..
}) = decoded
else {
panic!("expected a keybinding table, got {:?}", decoded... |
rust_dataset_chunk_519244 | rust_dataset.txt | 519,244 | 512 | ::GoToTab {
index: index as u32,
}],
)
})
.collect();
let payload = encode_keybinds_reply_payload(
6,
Ok(NestedSessionKeybinds {
session_path: vec!["guest".to_owned()],
mod... |
rust_dataset_chunk_519245 | rust_dataset.txt | 519,245 | 512 | illis(1000)));
assert!(!scheduler.on_tick(start + Duration::from_millis(2999)));
assert!(scheduler.on_tick(start + Duration::from_millis(3000)));
}
#[test]
fn host_contact_lifts_the_budget_and_resets_the_silence_window() {
let start = Instant::now();
let mut scheduler = test... |
rust_dataset_chunk_519246 | rust_dataset.txt | 519,246 | 512 | =
&["structured-frame", "key", "bytes", "paste", "mouse", "pin"];
pub const MAX_MIRROR_COLS: usize = 1000;
pub const MAX_MIRROR_ROWS: usize = 500;
pub const MIRROR_CONNECT_TIMEOUT: Duration = Duration::from_secs(5);
pub const MIRROR_PIN_RENEW_INTERVAL: Duration = Duration::from_secs(2);
pub const MIRROR_PIN_LEASE_... |
rust_dataset_chunk_519247 | rust_dataset.txt | 519,247 | 512 | _keyboard_protocol: bool,
},
Bytes(Vec<u8>),
Paste(Vec<u8>),
Mouse(MouseEvent),
}
#[derive(Debug, Clone, PartialEq)]
pub enum ViewerMessage {
Attach(MirrorAttach),
Input(MirrorInput),
Resize {
size: Size,
focused: bool,
resize_allowed: bool,
},
FrameAck {
... |
rust_dataset_chunk_519248 | rust_dataset.txt | 519,248 | 512 | MirrorClosedReason::PaneNotFound => proto::MirrorCloseReason::PaneNotFound,
MirrorClosedReason::ContainsViewer => proto::MirrorCloseReason::ContainsViewer,
MirrorClosedReason::UnsupportedHost
| MirrorClosedReason::ConnectionFailed
| MirrorClosedReason::ConnectionLost
| Mi... |
rust_dataset_chunk_519249 | rust_dataset.txt | 519,249 | 512 | M::Input(proto::MirrorInputMsg { input: Some(input) })
},
ViewerMessage::Resize {
size,
focused,
resize_allowed,
} => M::Resize(proto::MirrorResizeMsg {
size: Some(size_to_proto(*size)),
focused: *focuse... |
rust_dataset_chunk_519250 | rust_dataset.txt | 519,250 | 512 | .is_kitty_keyboard_protocol,
},
I::Bytes(bytes) => MirrorInput::Bytes(bytes),
I::Paste(bytes) => MirrorInput::Paste(bytes),
I::Mouse(event) => MirrorInput::Mouse(
event
.try_into()
... |
rust_dataset_chunk_519251 | rust_dataset.txt | 519,251 | 512 | DecodeError::Undecodable(e.to_string()))?;
match message.message.ok_or(MirrorDecodeError::Empty)? {
M::Attached(attached) => Ok(SourceMessage::Attached {
version: attached.version,
capabilities: attached.capabilities,
pane_size: size_from_proto(attache... |
rust_dataset_chunk_519252 | rust_dataset.txt | 519,252 | 512 | ,
"the frame is {}x{}, larger than the {}x{} limit",
cols, rows, MAX_MIRROR_COLS, MAX_MIRROR_ROWS
),
}
}
}
impl From<DecodeError> for MirrorFrameError {
fn from(e: DecodeError) -> Self {
MirrorFrameError::Decode(e)
}
}
#[derive(Debug, Clone, Part... |
rust_dataset_chunk_519253 | rust_dataset.txt | 519,253 | 512 | || resized;
if full {
*self = MirrorScreen {
wants_mouse: self.wants_mouse,
alternate_screen: self.alternate_screen,
..MirrorScreen::blank(header.cols, header.rows)
};
}
let links: HashMap<u8, String> = view
.li... |
rust_dataset_chunk_519254 | rust_dataset.txt | 519,254 | 512 | aint(&mut self) {
self.force_full = true;
}
pub fn encode(&mut self, current: &MirrorScreen) -> Option<EncodedFrame> {
let previous = self
.last
.as_ref()
.filter(|last| last.cols == current.cols && last.rows == current.rows);
let full = self.force_fu... |
rust_dataset_chunk_519255 | rust_dataset.txt | 519,255 | 512 | default()
}],
});
}
let mut link_ids: HashMap<String, u8> = HashMap::new();
let mut links = LinkRecord::default();
let mut run: Vec<WireCell> = Vec::new();
for (y, start, end) in spans {
run.clear();
for cell in ¤t.row(y)[... |
rust_dataset_chunk_519256 | rust_dataset.txt | 519,256 | 512 | ipped(&self) -> bool {
self.skipped
}
fn is_full(&self) -> bool {
self.in_flight.len() >= self.limit
}
pub fn wants_frame(&mut self, change: u64) -> bool {
let pending = self.sent_change != Some(change) || self.skipped || self.encoder.force_full;
if !pending {
... |
rust_dataset_chunk_519257 | rust_dataset.txt | 519,257 | 512 | .outgoing.take() {
let _ = outgoing.send(ViewerMessage::Detach);
}
}
}
impl Drop for LocalSocketTransport {
fn drop(&mut self) {
self.close();
}
}
impl MirrorConnector for LocalSocketConnector {
fn connect(
&self,
address: &PaneAddress,
attach: Mirro... |
rust_dataset_chunk_519258 | rust_dataset.txt | 519,258 | 512 | rap_viewer_message(&ViewerMessage::Attach(attach))) {
sink(MirrorTransportEvent::ConnectFailed(e.to_string()));
return;
}
let reader_sink = sink.clone();
let reader = std::thread::Builder::new()
.name(format!("pane_mirror_reader_{}", session))
.spawn(move || read_source_messa... |
rust_dataset_chunk_519259 | rust_dataset.txt | 519,259 | 512 | of a [`Pane`], or more generally of any terminal, measured
/// in character rows and columns.
#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize)]
pub struct PaneGeom {
pub x: usize,
pub y: usize,
pub rows: Dimension,
pub cols: Dimension,
pub stacked: Option<usize>, // usize - st... |
rust_dataset_chunk_519260 | rust_dataset.txt | 519,260 | 512 | struct Insets {
pub top: usize,
pub bottom: usize,
pub left: usize,
pub right: usize,
}
#[derive(Eq, Clone, Copy, PartialEq, Debug, Serialize, Deserialize, Hash)]
pub struct Dimension {
pub constraint: Constraint,
pub(crate) inner: usize,
}
impl Default for Dimension {
fn default() -> Sel... |
rust_dataset_chunk_519261 | rust_dataset.txt | 519,261 | 512 | {
match split_size {
SplitSize::Fixed(fixed) => Dimension {
constraint: Constraint::Fixed(fixed),
inner: fixed,
},
SplitSize::Percent(percent) => Dimension {
constraint: Constraint::Percent(percent as f64),
inne... |
rust_dataset_chunk_519262 | rust_dataset.txt | 519,262 | 512 | (&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let actual = match self {
Constraint::Fixed(v) => *v as f64,
Constraint::Percent(v) => *v,
};
write!(f, "{}", actual)?;
Ok(())
}
}
#[allow(clippy::derive_hash_xor_eq)]
impl Hash for Constraint {
... |
rust_dataset_chunk_519263 | rust_dataset.txt | 519,263 | 512 | aturating_sub(self.rows.as_usize()) / 2,
None => self.y,
};
}
pub fn adjust_coordinates(
&mut self,
floating_pane_coordinates: FloatingPaneCoordinates,
viewport: Viewport,
) {
self.apply_floating_pane_position(
floating_pane_coordinates.x,
... |
rust_dataset_chunk_519264 | rust_dataset.txt | 519,264 | 512 | _to_the_right.cols.inner;
Some(combined)
},
_ => {
log::error!("Can't combine fixed panes");
None
},
}
}
pub fn combine_vertically_with_many(&self, geoms_below: &Vec<PaneGeom>) -> Option<Self> {
// here we expect... |
rust_dataset_chunk_519265 | rust_dataset.txt | 519,265 | 512 | .x)?;
write!(f, r#""y": {},"#, self.y)?;
write!(f, r#""cols": {},"#, self.cols.constraint)?;
write!(f, r#""rows": {},"#, self.rows.constraint)?;
write!(f, r#""stacked": {:?}"#, self.stacked)?;
write!(f, r#""logical_position": {:?}"#, self.logical_position)?;
write!(f, " }... |
rust_dataset_chunk_519266 | rust_dataset.txt | 519,266 | 512 | mut cols = Dimension::percent(100.0);
rows.set_inner(size.rows);
cols.set_inner(size.cols);
Self {
rows,
cols,
..Default::default()
}
}
}
--- FILE: zellij/zellij-utils/src/pipe_access.rs ---
//! Who may use zellij's named pipes on Windows.
//!
/... |
rust_dataset_chunk_519267 | rust_dataset.txt | 519,267 | 512 | &Stream) -> HANDLE {
match stream {
Stream::NamedPipe(pipe) => pipe.inner().as_handle().as_raw_handle(),
}
}
fn owner_of(handle: HANDLE) -> io::Result<String> {
let mut owner = ptr::null_mut();
let mut descriptor = ptr::null_mut();
let error = unsafe {
GetSecurityInfo(
... |
rust_dataset_chunk_519268 | rust_dataset.txt | 519,268 | 512 | ddl(&Identity::current()?))
}
fn from_sddl(sddl: &str) -> io::Result<Self> {
let sddl: Vec<u16> = sddl.encode_utf16().chain(Some(0)).collect();
let mut descriptor = ptr::null_mut();
let made = unsafe {
ConvertStringSecurityDescriptorToSecurityDescriptorW(
sdd... |
rust_dataset_chunk_519269 | rust_dataset.txt | 519,269 | 512 | class,
buffer.as_mut_ptr().cast(),
length,
&mut length,
)
};
if read == 0 {
return Err(io::Error::last_os_error());
}
sid_string(unsafe { *buffer.as_ptr().cast::<PSID>() })
}
}
impl Drop for Token {
fn drop... |
rust_dataset_chunk_519270 | rust_dataset.txt | 519,270 | 512 | sddl = unsafe { wide_string(text) };
unsafe {
LocalFree(text.cast());
LocalFree(descriptor);
}
sddl
}
fn assert_private(sddl: &str) {
assert!(
!sddl.contains(";;;WD)") && !sddl.contains(";;;AN)"),
"every user or anonymous logons c... |
rust_dataset_chunk_519271 | rust_dataset.txt | 519,271 | 512 | ade() {
let dir = tempfile::TempDir::new().unwrap();
let path = dir.path().join("session");
let _requests = crate::consts::ipc_bind(&path).unwrap();
let _replies = crate::consts::ipc_bind_reply(&path).unwrap();
crate::pipe_pairs::connect_pair(&path).unwrap();
}
#[test]
... |
rust_dataset_chunk_519272 | rust_dataset.txt | 519,272 | 512 | ators, &normal),
"an elevated pipe is not a normal process's"
);
assert!(!is_ours("S-1-5-21-1-2-3-1002", &normal));
assert!(!is_ours("S-1-5-21-1-2-3-1002", &elevated));
}
#[test]
fn the_access_list_names_the_owner_and_integrity_level() {
let identity = Identity {... |
rust_dataset_chunk_519273 | rust_dataset.txt | 519,273 | 512 | };
/// How long half a connection waits for its other half before it is dropped.
const MAX_WAIT: Duration = Duration::from_secs(30);
const ACCEPT_ERROR_BACKOFF: Duration = Duration::from_millis(100);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Half {
Request,
Reply,
}
struct Waiting<T> {
proce... |
rust_dataset_chunk_519274 | rust_dataset.txt | 519,274 | 512 | });
}
}
#[cfg(test)]
fn waiting(&self) -> (usize, usize) {
(self.requests.len(), self.replies.len())
}
}
/// Accepts the request and reply halves of connections on their two listeners and hands out each
/// connection once both of its halves are there, request half first.
p... |
rust_dataset_chunk_519275 | rust_dataset.txt | 519,275 | 512 | connecting(path: &Path) -> Arc<Mutex<()>> {
static LOCKS: Mutex<Option<HashMap<PathBuf, Arc<Mutex<()>>>>> = Mutex::new(None);
LOCKS
.lock()
.unwrap_or_else(|e| e.into_inner())
.get_or_insert_with(HashMap::new)
.entry(path.to_path_buf())
.or_default()
.clone()
}
... |
rust_dataset_chunk_519276 | rust_dataset.txt | 519,276 | 512 | (Half::Reply, 8, pipe("b-reply"), now, is_gone)),
None
);
assert_eq!(
names(pairing.add(Half::Request, 8, pipe("b"), now, is_gone)),
Some(("b", "b-reply"))
);
assert_eq!(pairing.waiting(), (0, 0));
}
#[test]
fn interleaved_clients_each_get... |
rust_dataset_chunk_519277 | rust_dataset.txt | 519,277 | 512 | pipe("retry"), now, is_gone);
assert_eq!(
names(pairing.add(Half::Reply, 9, pipe("retry-reply"), now, is_gone)),
Some(("retry", "retry-reply"))
);
}
#[test]
fn real_pipes_pair_up_after_a_client_left_with_only_its_request_pipe() {
use std::io::{Read, Write};
... |
rust_dataset_chunk_519278 | rust_dataset.txt | 519,278 | 512 | PluginType,
pane_run::RunType,
run_plugin_location_data::LocationData,
run_plugin_or_alias::PluginType,
Action as ProtobufAction,
ActionName as ProtobufActionName,
AreFloatingPanesVisiblePayload,
BarNamesPayload,
BareKey as ProtobufBareKey,
// New ... |
rust_dataset_chunk_519279 | rust_dataset.txt | 519,279 | 512 | PanePayload,
SetPaneFrameStylePayload,
ShowFloatingPanesPayload,
SplitDirection as ProtobufSplitDirection,
SplitSize as ProtobufSplitSize,
StackedPlacement as ProtobufStackedPlacement,
SwapFloatingLayout as ProtobufSwapFloatingLayout,
SwapTiledLayout as ProtobufSw... |
rust_dataset_chunk_519280 | rust_dataset.txt | 519,280 | 512 | => match protobuf_action.optional_payload {
Some(OptionalPayload::WritePayload(write_payload)) => {
let key_with_modifier = write_payload
.key_with_modifier
.and_then(|k| k.try_into().ok());
Ok(Action::Write {
... |
rust_dataset_chunk_519281 | rust_dataset.txt | 519,281 | 512 | (_) => Err("FocusNextPane should not have a payload"),
None => Ok(Action::FocusNextPane),
},
Some(ProtobufActionName::FocusPreviousPane) => match protobuf_action.optional_payload {
Some(_) => Err("FocusPreviousPane should not have a payload"),
None... |
rust_dataset_chunk_519282 | rust_dataset.txt | 519,282 | 512 | payload"),
None => Ok(Action::MovePaneBackwards),
},
Some(ProtobufActionName::ClearScreen) => match protobuf_action.optional_payload {
Some(_) => Err("ClearScreen should not have a payload"),
None => Ok(Action::ClearScreen),
},
... |
rust_dataset_chunk_519283 | rust_dataset.txt | 519,283 | 512 | ProtobufActionName::ScrollToBottom) => match protobuf_action.optional_payload {
Some(_) => Err("ScrollToBottom should not have a payload"),
None => Ok(Action::ScrollToBottom),
},
Some(ProtobufActionName::ScrollToTop) => match protobuf_action.optional_payload {
... |
rust_dataset_chunk_519284 | rust_dataset.txt | 519,284 | 512 | match protobuf_action.optional_payload {
Some(_) => Err("ToggleFocusFullscreen should not have a payload"),
None => Ok(Action::ToggleFocusFullscreen),
}
},
Some(ProtobufActionName::ToggleFocusNoUiFullscreen) => {
... |
rust_dataset_chunk_519285 | rust_dataset.txt | 519,285 | 512 | let direction: Option<Direction> = payload
.direction
.and_then(|d| ProtobufResizeDirection::try_from(d).ok())
.and_then(|d| d.try_into().ok());
let pane_name = payload.pane_name;
Ok(Action::NewPane {
... |
rust_dataset_chunk_519286 | rust_dataset.txt | 519,286 | 512 | ,
near_current_pane,
no_focus: false,
tab_id: None,
})
}
},
_ => Err("Wrong payload for Action::NewFloatingPane"),
},
Some(ProtobufActio... |
rust_dataset_chunk_519287 | rust_dataset.txt | 519,287 | 512 | Err("Wrong payload for ShowFloatingPanes"),
},
Some(ProtobufActionName::HideFloatingPanes) => match protobuf_action.optional_payload {
Some(OptionalPayload::HideFloatingPanesPayload(payload)) => {
Ok(Action::HideFloatingPanes {
tab_id:... |
rust_dataset_chunk_519288 | rust_dataset.txt | 519,288 | 512 | | l.try_into())
.collect::<Result<Vec<_>, _>>()?,
)
};
let swap_floating_layouts = if payload.swap_floating_layouts.is_empty() {
None
} else {
... |
rust_dataset_chunk_519289 | rust_dataset.txt | 519,289 | 512 | => Ok(Action::GoToNextTab),
},
Some(ProtobufActionName::GoToPreviousTab) => match protobuf_action.optional_payload {
Some(_) => Err("GoToPreviousTab should not have a payload"),
None => Ok(Action::GoToPreviousTab),
},
Some(ProtobufActionNa... |
rust_dataset_chunk_519290 | rust_dataset.txt | 519,290 | 512 | ActionName::MoveTab) => match protobuf_action.optional_payload {
Some(OptionalPayload::MoveTabPayload(move_tab_payload)) => {
let direction: Direction = ProtobufMoveTabDirection::try_from(move_tab_payload)
.ok()
.ok_or("Malformed move t... |
rust_dataset_chunk_519291 | rust_dataset.txt | 519,291 | 512 | ::OpenContextMenu),
},
Some(ProtobufActionName::MutePane) => match protobuf_action.optional_payload {
Some(_) => Err("MutePane should not have a payload"),
None => Ok(Action::MutePane),
},
Some(ProtobufActionName::IgnorePaneOutput) => match... |
rust_dataset_chunk_519292 | rust_dataset.txt | 519,292 | 512 | None => Ok(Action::OpenSessionInTerminal),
}
},
Some(ProtobufActionName::ToggleMirrorResize) => {
match protobuf_action.optional_payload {
Some(_) => Err("ToggleMirrorResize should not have a payload"),
N... |
rust_dataset_chunk_519293 | rust_dataset.txt | 519,293 | 512 | WatchPaneByPaneId {
pane_id: payload
.pane_id
.ok_or("Missing pane id for Action::WatchPaneByPaneId")?
.try_into()?,
})
},
_ => Err("Wrong payload for Action::W... |
rust_dataset_chunk_519294 | rust_dataset.txt | 519,294 | 512 | payload.tab_id })
},
_ => Err("Wrong payload for Action::MuteTabByTabId"),
},
Some(ProtobufActionName::ToggleSessionCard) => match protobuf_action.optional_payload {
Some(_) => Err("ToggleSessionCard should not have a payload"),
No... |
rust_dataset_chunk_519295 | rust_dataset.txt | 519,295 | 512 | ,
skip_cache: skip_plugin_cache,
tab_id: None,
})
},
_ => Err("Wrong payload for Action::LaunchOrFocusPlugin"),
}
},
Some(ProtobufActionName::LaunchPlugin) => m... |
rust_dataset_chunk_519296 | rust_dataset.txt | 519,296 | 512 | _release_event(position),
})
},
_ => Err("Wrong payload for Action::MiddleMouseRelease"),
}
},
Some(ProtobufActionName::MouseEvent) => match protobuf_action.optional_payload {
Some(OptionalPayload::Mo... |
rust_dataset_chunk_519297 | rust_dataset.txt | 519,297 | 512 | => {
Ok(Action::ApplyTiledSwapLayout { name })
},
_ => Err("Wrong payload for Action::ApplyTiledSwapLayout"),
}
},
Some(ProtobufActionName::ApplyFloatingSwapLayout) => {
match protobuf_action.optiona... |
rust_dataset_chunk_519298 | rust_dataset.txt | 519,298 | 512 | ProtobufActionName::NewFloatingPluginPane) => {
match protobuf_action.optional_payload {
Some(OptionalPayload::NewFloatingPluginPanePayload(payload)) => {
let run_plugin_location =
RunPluginLocation::parse(&payload.plugin_url, None)... |
rust_dataset_chunk_519299 | rust_dataset.txt | 519,299 | 512 | .should_float;
let should_be_in_place_if_hidden = payload.should_be_in_place;
Ok(Action::FocusTerminalPaneWithId {
pane_id: terminal_pane_id,
should_float_if_hidden,
should_be_in_place_if_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.