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_1500 | rust_dataset.txt | 1,500 | 512 | Field renamed to MultipartField
## 1.0.0-alpha.1
### Changed
- Complete architecture re-design.
- Return 405 response if no matching route found within resource #538
--- FILE: actix-web/actix-web-codegen/CHANGES.md ---
# Changes
## Unreleased
## 4.6.0
- Add `guard_obj` parameter to all route attribute macros w... |
rust_dataset_chunk_1501 | rust_dataset.txt | 1,501 | 512 | /actix-web/pull/2771
## 4.0.0
- Version aligned with `actix-web` and will remain in sync going forward.
- No significant changes since `0.5.0`.
## 0.5.0
- No significant changes since `0.5.0-rc.2`.
## 0.5.0-rc.2
- No significant changes since `0.5.0-rc.1`.
## 0.5.0-rc.1
- Minimum supported Rust version (MSRV) i... |
rust_dataset_chunk_1502 | rust_dataset.txt | 1,502 | 512 | /actix/actix-web/pull/1674
## 0.3.0
- No significant changes from `0.3.0-beta.1`.
## 0.3.0-beta.1
- Add main entry-point macro that uses re-exported runtime. [#1559]
[#1559]: https://github.com/actix/actix-web/pull/1559
## 0.2.2
- Add resource middleware on actix-web-codegen [#1467]
[#1467]: https://github.com/... |
rust_dataset_chunk_1503 | rust_dataset.txt | 1,503 | 512 | ](https://img.shields.io/badge/rustc-1.89+-ab6000.svg)

<br />
[](https://deps.rs/crate/actix-web-codegen/4.6.0)
[`/`Route::with_async_config()` always passes configuration objects as tuple even for handler with one parameter.
# 0.7
- `HttpRequest` does not implement `Stream` anymore. If you need to read r... |
rust_dataset_chunk_1505 | rust_dataset.txt | 1,505 | 512 | |r| {
r.method(http::Method::GET)
.with_config(index, |cfg| { // <- register handler
cfg.limit(4096); // <- limit size of the payload
})
});
}
```
- `Route::with_async()` does not return `ExtractorConfig`, to configure extractor use `Route::with_a... |
rust_dataset_chunk_1506 | rust_dataset.txt | 1,506 | 512 | _web::http` module
- `actix_web::header` moved to `actix_web::http::header`
- `NormalizePath` moved to `actix_web::http` module
- `HttpServer` moved to `actix_web::server`, added new `actix_web::server::new()` function, shortcut for `actix_web::server::HttpServer::new()`
- `DefaultHeaders` middleware does not use s... |
rust_dataset_chunk_1507 | rust_dataset.txt | 1,507 | 512 | {
println!("use the config: {:?}", cfg.config);
...
}
}
App::new().resource("/route_with_config", |r| {
r.post().with_config(handler_fn, |cfg| {
cfg.0.config = "test".to_string();
})
})
```
use the HttpRequest to get the configuration like any other `Data` with `r... |
rust_dataset_chunk_1508 | rust_dataset.txt | 1,508 | 512 | _id}")
.service(web::resource("/path1").to(|| HttpResponse::Ok()))
.service(web::resource("/path2").to(|| HttpResponse::Ok()))
.service(web::resource("/path3").to(|| HttpResponse::MethodNotAllowed()))
);
```
- `.with()`, `.with_async()` registration methods have been r... |
rust_dataset_chunk_1509 | rust_dataset.txt | 1,509 | 512 | api.
instead of
```rust
App.with_state(T)
```
use App's `data` method
```rust
App.new()
.data(T)
```
and either use the Data extractor within your handler
```rust
use actix_web::web::Data;
fn endpoint_handler(Data<T>)){
...
}
```
.. or access your Data element f... |
rust_dataset_chunk_1510 | rust_dataset.txt | 1,510 | 512 | use actix_web::multipart::Multipart`
use `use actix_multipart::Multipart`
- Response compression is not enabled by default. To enable, use `Compress` middleware, `App::new().wrap(Compress::default())`.
- Session middleware moved to actix-session crate
- Actors support have been moved to `actix-web-actors` crate
... |
rust_dataset_chunk_1511 | rust_dataset.txt | 1,511 | 512 | 0.0", features = ["ssl"] }
```
use
```rust
actix-web = { version = "2.0.0", features = ["openssl"] }
```
- `Cors` builder now requires that you call `.finish()` to construct the middleware
--- FILE: actix-web/actix-web/MIGRATION-3.0.md ---
# Migrating to 3.0.0
- The return type for `ServiceRequest::app_... |
rust_dataset_chunk_1512 | rust_dataset.txt | 1,512 | 512 | }
// Or (this wasn't previously supported):
async fn some_route(web::Path((first_name, last_name)): web::Path<(String, String)>) -> String {
format!("Hello, {} {}", first_name, last_name)
}
```
- `middleware::NormalizePath` can now also be configured to trim trailing slashes instead of always keeping one.... |
rust_dataset_chunk_1513 | rust_dataset.txt | 1,513 | 512 | Path`](#webpath)
- [Rustls Crate Upgrade](#rustls-crate-upgrade)
- [Removed `awc` Client Re-export](#removed-awc-client-re-export)
- [Integration Testing Utils Moved To `actix-test`](#integration-testing-utils-moved-to-actix-test)
- [Header APIs](#header-apis)
- [Response Body Types](#response-body-types)
- [Middleware... |
rust_dataset_chunk_1514 | rust_dataset.txt | 1,514 | 512 | or "module XYZ not found", check the [documentation on docs.rs](https://docs.rs/actix-web) to search for items' new locations.
## `NormalizePath` Middleware :warning:
The default `NormalizePath` behavior now strips trailing slashes by default. This was the _documented_ behaviour in Actix Web v3, but the _actual_ beh... |
rust_dataset_chunk_1515 | rust_dataset.txt | 1,515 | 512 | web::Path` is now private. It was causing ambiguity when trying to use tuple indexing due to its `Deref` implementation.
```diff
- async fn handler(web::Path((foo, bar)): web::Path<(String, String)>) {
+ async fn handler(params: web::Path<(String, String)>) {
+ let (foo, bar) = params.into_inner();
```
An alternati... |
rust_dataset_chunk_1516 | rust_dataset.txt | 1,516 | 512 | "1234"))
- .header("Api-Key", "1234")
+ .append_header(("Api-Key", "1234"))
- .set(ContentType::json())
+ .insert_header(ContentType::json())
```
We chose to deprecate most of the old methods instead of removing them immediately—the warning notes will guide you on how to update.
## Response Body Types
There have ... |
rust_dataset_chunk_1517 | rust_dataset.txt | 1,517 | 512 | 's `B` body type or a boxed body type from elsewhere, likely constructed within the middleware itself". Of course, if your middleware contains only simple string other/error responses, it's possible to use them without boxes at the cost of a less simple implementation:
```rust
type Response = Result<ServiceResponse<Ei... |
rust_dataset_chunk_1518 | rust_dataset.txt | 1,518 | 512 | state, it reduces the runtime overhead in places where a `RefCell` used to be required for wrapping an inner service.
- We've also introduced some macros that reduce boilerplate when implementing `poll_ready`.
- Further to the guidance on [response body types](#response-body-types), any use of the old methods on `Serv... |
rust_dataset_chunk_1519 | rust_dataset.txt | 1,519 | 512 | type Response = ServiceResponse<B>;
type Error = Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
- fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
- self.service.poll_ready(cx)
- }
+ actix_web::dev::forward_ready!(ser... |
rust_dataset_chunk_1520 | rust_dataset.txt | 1,520 | 512 | charset=utf-8")
.body(self);
- ok(res)
+ res
}
}
```
## `App::data` Deprecation :warning:
The `App::data` method is deprecated. Replace instances of this with `App::app_data`. Exposing both methods led to lots of confusion when trying to extract the data in handlers. Now, when ... |
rust_dataset_chunk_1521 | rust_dataset.txt | 1,521 | 512 | will no longer be able to serve requests with v4.0:
```rust
#[actix_web::main]
async fn main() {
HttpServer::new(|| App::new().default_service(web::to(HttpResponse::Conflict)))
.bind(("127.0.0.1", 8080))
.unwrap()
.run();
thread::sleep(Duration::from_secs(1000));
}
```
## Guards API
... |
rust_dataset_chunk_1522 | rust_dataset.txt | 1,522 | 512 | that uses Tokio's multi-threaded mode; you can simply await the server within this context or, if preferred, use `tokio::spawn` just like any other async task.
For now, `actix` actor support (and therefore WebSocket support via `actix-web-actors`) still requires `#[actix_web::main]` so that a `System` context is crea... |
rust_dataset_chunk_1523 | rust_dataset.txt | 1,523 | 512 |
--- FILE: actix-web/actix-web/README.md ---
<div align="center">
<h1>Actix Web</h1>
<p>
<strong>Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust</strong>
</p>
<p>
<!-- prettier-ignore-start -->
[](https://c... |
rust_dataset_chunk_1524 | rust_dataset.txt | 1,524 | 512 | ultipart streams
- Static assets
- SSL support using OpenSSL or Rustls
- Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
- Integrates with the [`awc` HTTP client](https://docs.rs/awc/)
- Runs on stable Rust 1.89+
### Experimental features
To enable faster release iterations, we mark some... |
rust_dataset_chunk_1525 | rust_dataset.txt | 1,525 | 512 | actix/examples/tree/main/databases/sqlite)
- [Postgres Integration](https://github.com/actix/examples/tree/main/databases/postgres)
- [Tera Templates](https://github.com/actix/examples/tree/main/templating/tera)
- [Askama Templates](https://github.com/actix/examples/tree/main/templating/askama)
- [HTTPS using Rustls](h... |
rust_dataset_chunk_1526 | rust_dataset.txt | 1,526 | 512 | ., logging, compression)
- Modify application state through ServiceRequest
- Access external services (e.g., sessions, caching)
Middleware is registered for each App, Scope, or Resource and executed in the reverse order of registration. This means the last registered middleware is the first to process the request.
##... |
rust_dataset_chunk_1527 | rust_dataset.txt | 1,527 | 512 | ERROR: type should be string, got " https://docs.rs/actix-web\n- Service Trait Documentation: https://docs.rs/actix-service\n- MessageBody Trait Documentation: https://docs.rs/actix-web/latest/actix_web/body/trait.MessageBody.html\n\n\n--- FILE: actix-web/awc/CHANGES.md ---\n# Changes\n\n## Unreleased\n\n## 3.11.0\n\n- Add `Client::query()` method for constructing HTTP `QUERY` requests.\n- Minimum supported Rust version (MSRV) is now 1.89.\n\n## 3.10.0\n\n- Parse all `Connection` header options when validating WebSocket handshakes.\n- Update `zstd` dependency to `0.14`.\n- Update `brotli` dependency to `9`.\n\n## 3.9.0\n\n- Add camel-case header controls to `WebsocketsRequest` via `camel_case_headers()` and `set_camel_case_headers()`.\n- Update `hickory-resolver` dependency to `0.26`.\n\n## 3.8.2\n\n- Minimum supported Rust version (MSRV) is now 1.88.\n- Fix empty streaming request bodies being sent with chunked transfer encoding.\n\n## 3.8.1\n\n- Fix a bug where `GO_AWAY` errors did not stop connections from returning to the pool.\n\n## 3.8.0\n\n- Add `hickory-dns` crate feature (off-by-default).\n- The `trust-dns` crate feature now delegates DNS resolution to `hickory-dns`.\n\n## 3.7.0\n\n- Update `brotli` dependency to `8`.\n\n## 3.6.0\n\n- Prevent panics on connection pool drop when Tokio runtime is shutdown early.\n- Do not send `Host` header on HTTP/2 requests, as it is not required, and some web servers may reject it.\n- Update `brotli` dependency to `7`.\n- Minimum supported Rust version (MSRV) is now 1.75.\n\n## 3.5.1\n\n- Fix WebSocket `Host` request header value when using a non-default port.\n\n## 3.5.0\n\n- Add `rustls-0_23`, `rustls-0_23-webpki-roots`, and `rustls-0_23-native-roots` crate features.\n- Add `awc::Connector::rustls_0_23()` constructor.\n- Fix `rust" |
rust_dataset_chunk_1528 | rust_dataset.txt | 1,528 | 512 | ls-0_22-native-roots` root store lookup.
- Update `brotli` dependency to `6`.
- Minimum supported Rust version (MSRV) is now 1.72.
## 3.4.0
- Add `rustls-0_22-webpki-roots` and `rustls-0_22-native-roots` crate feature.
- Add `awc::Connector::rustls_0_22()` method.
## 3.3.0
- Update `trust-dns-resolver` dependency t... |
rust_dataset_chunk_1529 | rust_dataset.txt | 1,529 | 512 | compress-brotli` crate feature; enabled by default. [#2250]
- `compress-gzip` crate feature; enabled by default. [#2250]
- `compress-zstd` crate feature; enabled by default. [#2250]
- `client::Connector::handshake_timeout()` for customizing TLS connection handshake timeout. [#2081]
- `client::ConnectorService` as `clie... |
rust_dataset_chunk_1530 | rust_dataset.txt | 1,530 | 512 | 2503]
- `ClientRequest::send_body` now takes an `impl MessageBody`. [#2546]
- Rename `MessageBody => ResponseBody` to avoid conflicts with `MessageBody` trait. [#2546]
- Minimum supported Rust version (MSRV) is now 1.54.
### Fixed
- Send headers along with redirected requests. [#2310]
- Improve `Client` instantiation... |
rust_dataset_chunk_1531 | rust_dataset.txt | 1,531 | 512 | /pull/1969
[#1981]: https://github.com/actix/actix-web/pull/1981
[#2008]: https://github.com/actix/actix-web/pull/2008
[#2024]: https://github.com/actix/actix-web/pull/2024
[#2050]: https://github.com/actix/actix-web/pull/2050
[#2063]: https://github.com/actix/actix-web/pull/2063
[#2081]: https://github.com/actix/actix... |
rust_dataset_chunk_1532 | rust_dataset.txt | 1,532 | 512 | -beta.19`.
## 3.0.0-beta.19
- No significant changes since `3.0.0-beta.18`.
## 3.0.0-beta.18
- Minimum supported Rust version (MSRV) is now 1.54.
## 3.0.0-beta.17
### Changed
- Update `cookie` dependency (re-exported) to `0.16`. [#2555]
### Security
- `cookie` upgrade addresses [`RUSTSEC-2020-0071`].
[#2555]:... |
rust_dataset_chunk_1533 | rust_dataset.txt | 1,533 | 512 | .com/actix/actix-web/pull/2510
## 3.0.0-beta.13
- No significant changes since `3.0.0-beta.12`.
## 3.0.0-beta.12
- Update `actix-tls` to `3.0.0-rc.1`. [#2474]
[#2474]: https://github.com/actix/actix-web/pull/2474
## 3.0.0-beta.11
- No significant changes from `3.0.0-beta.10`.
## 3.0.0-beta.10
- No significant ... |
rust_dataset_chunk_1534 | rust_dataset.txt | 1,534 | 512 | ://github.com/actix/actix-web/pull/2094
[#2114]: https://github.com/actix/actix-web/pull/2114
[#2116]: https://github.com/actix/actix-web/pull/2116
## 3.0.0-beta.3
### Added
- `ClientResponse::timeout` for set the timeout of collecting response body. [#1931]
- `ClientBuilder::local_address` for bind to a local ip ad... |
rust_dataset_chunk_1535 | rust_dataset.txt | 1,535 | 512 | 1905]: https://github.com/actix/actix-web/pull/1905
[#1969]: https://github.com/actix/actix-web/pull/1969
## 3.0.0-beta.1
### Changed
- Update `rand` to `0.8`
- Update `bytes` to `1.0`. [#1813]
- Update `rust-tls` to `0.19`. [#1813]
[#1813]: https://github.com/actix/actix-web/pull/1813
</details>
## 2.0.3
### Fi... |
rust_dataset_chunk_1536 | rust_dataset.txt | 1,536 | 512 | ump minimum supported Rust version to 1.40
- Update `base64` dependency to 0.12
[#1422]: https://github.com/actix/actix-web/pull/1422
## 2.0.0-alpha.1
- Update `actix-http` dependency to 2.0.0-alpha.2
- Update `rustls` dependency to 0.17
- ClientBuilder accepts initial_window_size and initial_connection_window_size ... |
rust_dataset_chunk_1537 | rust_dataset.txt | 1,537 | 512 | 1.0-alpha.5
### Changed
- Do not set any default headers
### Added
- Add Debug impl for BoxedSocket
## 0.1.0-alpha.4
### Changed
- Update actix-http dependency
## 0.1.0-alpha.3
### Added
- Export `MessageBody` type
- `ClientResponse::json()` - Loads and parse `application/json` encoded body
### Changed
- `... |
rust_dataset_chunk_1538 | rust_dataset.txt | 1,538 | 512 | _on(async {
let client = Client::default();
let res = client
.get("http://www.rust-lang.org") // <- Create request builder
.insert_header(("User-Agent", "Actix-web"))
.send() // <- Send http request
.await;
println!... |
rust_dataset_chunk_1539 | rust_dataset.txt | 1,539 | 512 | they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting... |
rust_dataset_chunk_1540 | rust_dataset.txt | 1,540 | 512 | Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the dif... |
rust_dataset_chunk_1541 | rust_dataset.txt | 1,541 | 512 | through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control wi... |
rust_dataset_chunk_1542 | rust_dataset.txt | 1,542 | 512 | the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communicati... |
rust_dataset_chunk_1543 | rust_dataset.txt | 1,543 | 512 | the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works;... |
rust_dataset_chunk_1544 | rust_dataset.txt | 1,544 | 512 | . Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
... |
rust_dataset_chunk_1545 | rust_dataset.txt | 1,545 | 512 | included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017-NOW Actix Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a co... |
rust_dataset_chunk_1546 | rust_dataset.txt | 1,546 | 512 | =VERSION={version}");
let dest = env::var("OUT_DIR").unwrap();
let mut file = File::create(Path::new(&dest).join("gl_bindings.rs")).unwrap();
Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, [
"GL_ARB_blend_func_extended",
"GL_KHR_robustness",
"GL_KHR_debug",
])
... |
rust_dataset_chunk_1547 | rust_dataset.txt | 1,547 | 512 | _lowercase();
match_arms_stream.extend(quote! {
#literal => Ok(#ident :: #variant_ident),
});
}
// Remove trailing `, ` from the last enum variant.
available_values.truncate(available_values.len().saturating_sub(2));
// Generate deserialization impl.
let mut tokens = q... |
rust_dataset_chunk_1548 | rust_dataset.txt | 1,548 | 512 | FieldStreams { flatten, match_assignments } = fields_deserializer(&fields);
let visitor = format_ident!("{}Visitor", ident);
// Generate deserialization impl.
let mut tokens = quote! {
#[derive(Default)]
#[allow(non_snake_case)]
struct #visitor <#unconstrained> {
#phant... |
rust_dataset_chunk_1549 | rust_dataset.txt | 1,549 | 512 | // Create the deserialization stream for each field.
for field in fields.iter() {
if let Err(err) = field_deserializer(&mut field_streams, field) {
field_streams.flatten = err.to_compile_error();
return field_streams;
}
}
field_streams
}
/// Append a single field d... |
rust_dataset_chunk_1550 | rust_dataset.txt | 1,550 | 512 | .push_str("\nUse `alacritty migrate` to automatically resolve it");
// Append stream to log deprecation/removal warning.
match_assignment_stream.extend(quote! {
log::warn!(target: #LOG_TARGET, #message);
});
},
// Add aliases t... |
rust_dataset_chunk_1551 | rust_dataset.txt | 1,551 | 512 | use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::parse::{self, Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{GenericParam, Ident, LitStr, Token, TypeParam};
mod config_deserialize;
mod serde_replace;
/// Error message when attempting to flatten mu... |
rust_dataset_chunk_1552 | rust_dataset.txt | 1,552 | 512 | .parse()).ok();
Ok(Self { ident, param })
}
}
--- FILE: alacritty/alacritty_config_derive/src/serde_replace.rs ---
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::punctuated::Punctuated;
use syn::{
Data, DataStruct, DeriveInput, Error, Field, Field... |
rust_dataset_chunk_1553 | rust_dataset.txt | 1,553 | 512 | (&mut self, value: toml::Value) -> Result<(), Box<dyn std::error::Error>> {
match value.as_table() {
Some(table) => {
for (field, next_value) in table {
let next_value = next_value.clone();
let value = va... |
rust_dataset_chunk_1554 | rust_dataset.txt | 1,554 | 512 | }
Ok(value)
})
.collect::<Result<Vec<String>, String>>()
.map_err(|msg| Error::new(ident.span(), msg))?;
stream.extend(quote! {
#(#aliases)|* | #literal => alacritty_config::SerdeReplace::replace(&mut
self... |
rust_dataset_chunk_1555 | rust_dataset.txt | 1,555 | 512 | _alias_field: 0,
}
}
}
#[derive(ConfigDeserialize, Default)]
struct Test2<T: Default> {
field1: T,
field2: Option<usize>,
#[config(skip)]
field3: usize,
#[config(alias = "aliased")]
field4: u8,
newtype: NewType,
}
#[derive(ConfigDeserialize, Default)]
struct Test3 {
#[confi... |
rust_dataset_chunk_1556 | rust_dataset.txt | 1,556 | 512 | : enom_error: unknown variant `HugaBuga`, expected one of `One`, `Two`, \
`Three`",
"Config error: field1: invalid type: string \"testing\", expected usize",
]);
let mut warn_logs = logger.warn_logs.lock().unwrap();
warn_logs.sort_unstable();
assert_eq!(warn_logs.as_slice(), [
"... |
rust_dataset_chunk_1557 | rust_dataset.txt | 1,557 | 512 | toml::from_str("field1_alias=9").unwrap();
test.replace(value).unwrap();
assert_eq!(test.field1, 9);
}
#[test]
fn replace_derive_using_multiple_aliases() {
let mut test = Test::default();
let toml_value = toml::from_str("multiple_alias1=6").unwrap();
test.replace(toml_value).unwrap();
asser... |
rust_dataset_chunk_1558 | rust_dataset.txt | 1,558 | 512 | where
D: Deserialize<'de>,
{
*data = D::deserialize(value)?;
Ok(())
}
impl<'de, T: Deserialize<'de>> SerdeReplace for Vec<T> {
fn replace(&mut self, value: Value) -> Result<(), Box<dyn Error>> {
replace_simple(self, value)
}
}
impl<'de, T: SerdeReplace + Deserialize<'de>> SerdeReplace for... |
rust_dataset_chunk_1559 | rust_dataset.txt | 1,559 | 512 | "wayland", not(any(target_os = "macos", windows))))]
use copypasta::wayland_clipboard;
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
use copypasta::x11_clipboard::{Primary as X11SelectionClipboard, X11ClipboardContext};
pub struct Clipboard {
clipboard: Box<dyn ClipboardProvider>,
selec... |
rust_dataset_chunk_1560 | rust_dataset.txt | 1,560 | 512 | });
}
pub fn load(&mut self, ty: ClipboardType) -> String {
let clipboard = match (ty, &mut self.selection) {
(ClipboardType::Selection, Some(provider)) => provider,
_ => &mut self.clipboard,
};
match clipboard.get_contents() {
Err(err) => {
... |
rust_dataset_chunk_1561 | rust_dataset.txt | 1,561 | 512 | default: $HOME/.config/alacritty/alacritty.toml].
#[cfg(target_os = "macos")]
#[clap(long, value_hint = ValueHint::FilePath)]
pub config_file: Option<PathBuf>,
/// Path for IPC socket creation.
#[cfg(unix)]
#[clap(long, value_hint = ValueHint::FilePath)]
pub socket: Option<PathBuf>,
//... |
rust_dataset_chunk_1562 | rust_dataset.txt | 1,562 | 512 | _events => LevelFilter::Info,
// Default.
(0, 0) => LevelFilter::Warn,
// Verbose.
(_, 1) => LevelFilter::Info,
(_, 2) => LevelFilter::Debug,
(0, _) => LevelFilter::Trace,
// Quiet.
(1, _) => LevelFilter::Error,
... |
rust_dataset_chunk_1563 | rust_dataset.txt | 1,563 | 512 | Some(working_directory) = &self.working_directory {
if working_directory.is_dir() {
pty_config.working_directory = Some(working_directory.to_owned());
} else {
error!("Invalid working directory: {working_directory:?}");
}
}
if let Som... |
rust_dataset_chunk_1564 | rust_dataset.txt | 1,564 | 512 | }
/// Available socket messages.
#[cfg(unix)]
#[derive(Subcommand, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub enum SocketMessage {
/// Create a new window in the same Alacritty process.
CreateWindow(WindowOptions),
/// Update the Alacritty configuration.
Config(IpcConfig),
/// Read... |
rust_dataset_chunk_1565 | rust_dataset.txt | 1,565 | 512 | config` IPC subcommand.
#[cfg(unix)]
#[derive(Args, Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
pub struct IpcConfig {
/// Configuration file options [example: 'cursor.style="Beam"'].
#[clap(required = true, value_name = "CONFIG_OPTIONS")]
pub options: Vec<String>,
/// Window ID for ... |
rust_dataset_chunk_1566 | rust_dataset.txt | 1,566 | 512 | .config_options.swap_remove(i);
},
Ok(_) => i += 1,
}
}
}
/// Apply CLI config overrides to a CoW config.
pub fn override_config_rc(&mut self, config: Rc<UiConfig>) -> Rc<UiConfig> {
// Skip clone without write requirement.
if self.config_... |
rust_dataset_chunk_1567 | rust_dataset.txt | 1,567 | 512 | Value::Boolean(true));
let mut table = Table::new();
table.insert(String::from("parent"), Value::Table(parent_table));
assert_eq!(value, Value::Table(table));
}
#[test]
fn invalid_option_as_value() {
let value = toml::from_str::<Value>("}");
assert!(value.is_err())... |
rust_dataset_chunk_1568 | rust_dataset.txt | 1,568 | 512 | generated);
let mut completion = String::new();
let mut file = File::open(format!("../extra/completions/{file}")).unwrap();
file.read_to_string(&mut completion).unwrap();
assert_eq!(generated, completion);
}
// NOTE: Use this to generate new completions... |
rust_dataset_chunk_1569 | rust_dataset.txt | 1,569 | 512 | animation.
EaseOutSine,
// Penner animation.
EaseOutQuad,
// Penner animation.
EaseOutCubic,
// Penner animation.
EaseOutQuart,
// Penner animation.
EaseOutQuint,
// Penner animation.
EaseOutExpo,
// Penner animation.
EaseOutCirc,
// Penner animation.
#[defau... |
rust_dataset_chunk_1570 | rust_dataset.txt | 1,570 | 512 | is_triggered_by(&self, mode: BindingMode, mods: ModifiersState, input: &T) -> bool {
// Check input first since bindings are stored in one big list. This is
// the most likely item to fail so prioritizing it here allows more
// checks to be short circuited.
self.trigger == *input
... |
rust_dataset_chunk_1571 | rust_dataset.txt | 1,571 | 512 | ,
/// Scroll exactly one page down.
ScrollPageDown,
/// Scroll half a page up.
ScrollHalfPageUp,
/// Scroll half a page down.
ScrollHalfPageDown,
/// Scroll one line up.
ScrollLineUp,
/// Scroll one line down.
ScrollLineDown,
/// Scroll all the way to the top.
Scrol... |
rust_dataset_chunk_1572 | rust_dataset.txt | 1,572 | 512 | fn from(action: ViAction) -> Self {
Self::Vi(action)
}
}
impl From<ViMotion> for Action {
fn from(motion: ViMotion) -> Self {
Self::ViMotion(motion)
}
}
impl From<SearchAction> for Action {
fn from(action: SearchAction) -> Self {
Self::Search(action)
}
}
impl From<Mous... |
rust_dataset_chunk_1573 | rust_dataset.txt | 1,573 | 512 | .
SemanticSearchBackward,
}
/// Search mode specific actions.
#[allow(clippy::enum_variant_names)]
#[derive(ConfigDeserialize, Debug, Copy, Clone, PartialEq, Eq)]
pub enum SearchAction {
/// Move the focus to the next search match.
SearchFocusNext,
/// Move the focus to the previous search match.
S... |
rust_dataset_chunk_1574 | rust_dataset.txt | 1,574 | 512 | :literal,) => {{ BindingKey::Keycode { key: Key::Character($key.into()), location: KeyLocation::Any } }};
(KeyBinding, $key:ident, $location:expr) => {{ BindingKey::Keycode { key: Key::Named(NamedKey::$key), location: $location } }};
(KeyBinding, $key:ident,) => {{ BindingKey::Keycode { key: Key::Named(NamedKey... |
rust_dataset_chunk_1575 | rust_dataset.txt | 1,575 | 512 | Mode::SEARCH; Action::Esc("\x1bOF".into());
ArrowUp, +BindingMode::APP_CURSOR, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\x1bOA".into());
ArrowDown, +BindingMode::APP_CURSOR, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\x1bOB".into());
ArrowRight, +BindingMode::APP_CURSOR... |
rust_dataset_chunk_1576 | rust_dataset.txt | 1,576 | 512 | Mode::SEARCH, ~BindingMode::REPORT_ALL_KEYS_AS_ESC; Action::Esc("\x7f".into());
Backspace, ModifiersState::ALT, ~BindingMode::VI, ~BindingMode::SEARCH, ~BindingMode::REPORT_ALL_KEYS_AS_ESC, ~BindingMode::DISAMBIGUATE_ESC_CODES; Action::Esc("\x1b\x7f".into());
Backspace, ModifiersState::SHIFT, ~Bin... |
rust_dataset_chunk_1577 | rust_dataset.txt | 1,577 | 512 | +BindingMode::VI, ~BindingMode::SEARCH; Action::ScrollPageDown;
"u", ModifiersState::CONTROL, +BindingMode::VI, ~BindingMode::SEARCH; Action::ScrollHalfPageUp;
"d", ModifiersState::CONTROL, +BindingMode::VI, ~BindingMode::SEARCH; Action::ScrollHalfPageDown;
"y", ... |
rust_dataset_chunk_1578 | rust_dataset.txt | 1,578 | 512 | BindingMode::VI, ~BindingMode::SEARCH; ViAction::InlineSearchForward;
"f", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViAction::InlineSearchBackward;
"t", +BindingMode::VI, ~BindingMode::SEARCH; ViAction::InlineSearchForwardShort;
"t", ... |
rust_dataset_chunk_1579 | rust_dataset.txt | 1,579 | 512 | "h", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::High;
"m", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Middle;
"l", ModifiersState::SHIFT, +BindingMode::VI, ~BindingMode::SEARCH; ViMotion::Low;
"b", ... |
rust_dataset_chunk_1580 | rust_dataset.txt | 1,580 | 512 | ::SearchHistoryPrevious;
ArrowDown, +BindingMode::SEARCH; SearchAction::SearchHistoryNext;
Enter, +BindingMode::SEARCH, ~BindingMode::VI; SearchAction::SearchFocusNext;
Enter, ModifiersState::SHIFT, +BindingMode::SEARCH, ~BindingMode::V... |
rust_dataset_chunk_1581 | rust_dataset.txt | 1,581 | 512 | ; Action::ToggleFullscreen;
);
bindings.extend(common_keybindings());
bindings
}
#[cfg(all(target_os = "macos", not(test)))]
pub fn platform_key_bindings() -> Vec<KeyBinding> {
bindings!(
KeyBinding;
Insert, ModifiersState::SHIFT, ~BindingMode::VI, ~BindingMode::SEARCH; Action::Esc("\x1... |
rust_dataset_chunk_1582 | rust_dataset.txt | 1,582 | 512 | ModifiersState::SUPER, +BindingMode::VI, +BindingMode::SEARCH; Action::Paste;
"n", ModifiersState::SUPER; Action::CreateNewWindow;
"f", ModifiersState::CONTROL | ModifiersState::SUPER; Action::ToggleFullscreen;
"c", ModifiersState::... |
rust_dataset_chunk_1583 | rust_dataset.txt | 1,583 | 512 | ad,
}
}
}
impl PartialEq for KeyLocation {
fn eq(&self, other: &Self) -> bool {
matches!(
(self, other),
(_, KeyLocation::Any)
| (KeyLocation::Any, _)
| (KeyLocation::Standard, KeyLocation::Standard)
| (KeyLocation::Numpad,... |
rust_dataset_chunk_1584 | rust_dataset.txt | 1,584 | 512 | Key::Named(NamedKey::Enter), KeyLocation::Standard),
"Return" => (Key::Named(NamedKey::Enter), KeyLocation::Standard),
"Plus" => (Key::Character("+".into()), KeyLocation::Standard),
"Comma" => (Key::Character(",".into()), KeyLocation::Standard),
... |
rust_dataset_chunk_1585 | rust_dataset.txt | 1,585 | 512 | KeyLocation::Numpad),
"NumpadMultiply" => (Key::Character("*".into()), KeyLocation::Numpad),
"Numpad1" => (Key::Character("1".into()), KeyLocation::Numpad),
"Numpad2" => (Key::Character("2".into()), KeyLocation::Numpad),
"N... |
rust_dataset_chunk_1586 | rust_dataset.txt | 1,586 | 512 | _ESC_CODES = 0b0010_0000;
const REPORT_ALL_KEYS_AS_ESC = 0b0100_0000;
}
}
impl BindingMode {
pub fn new(mode: &TermMode, search: bool) -> BindingMode {
let mut binding_mode = BindingMode::empty();
binding_mode.set(BindingMode::APP_CURSOR, mode.contains(TermMode::APP_CURSOR));
bi... |
rust_dataset_chunk_1587 | rust_dataset.txt | 1,587 | 512 | "~appkeypad" => res.not_mode |= BindingMode::APP_KEYPAD,
"alt" => res.mode |= BindingMode::ALT_SCREEN,
"~alt" => res.not_mode |= BindingMode::ALT_SCREEN,
"vi" => res.mode |= BindingMode::VI,
"~vi" => ... |
rust_dataset_chunk_1588 | rust_dataset.txt | 1,588 | 512 | (MouseButton::Back)),
"Forward" => Ok(MouseEvent::Button(MouseButton::Forward)),
"WheelUp" => Ok(MouseEvent::WheelUp),
"WheelDown" => Ok(MouseEvent::WheelDown),
_ => Err(E::invalid_value(Unexpected::Str(value), &self)),
}
... |
rust_dataset_chunk_1589 | rust_dataset.txt | 1,589 | 512 | f.write_str("binding fields")
}
fn visit_str<E>(self, value: &str) -> Result<Field, E>
where
E: de::Error,
{
match value.to_ascii_lowercase().as_str() {
"key" => ... |
rust_dataset_chunk_1590 | rust_dataset.txt | 1,590 | 512 | None => {
key = Some(
BindingKey::deserialize(value).map_err(V::Error::custom)?,
)
},
}
},
Field::M... |
rust_dataset_chunk_1591 | rust_dataset.txt | 1,591 | 512 | >()?);
},
}
}
let mode = mode.unwrap_or_else(BindingMode::empty);
let not_mode = not_mode.unwrap_or_else(BindingMode::empty);
let mods = mods.unwrap_or_default();
let action = match (action, cha... |
rust_dataset_chunk_1592 | rust_dataset.txt | 1,592 | 512 | Deserialize<'de> for SerdeViMotion {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let value = deserializer.deserialize_str(StringVisitor)?;
ViMotion::deserialize(SerdeValue::String(value))
.map(SerdeViMotion)
.map... |
rust_dataset_chunk_1593 | rust_dataset.txt | 1,593 | 512 | (),
action: Action::None,
mode: BindingMode::empty(),
notmode: BindingMode::empty(),
trigger: Default::default(),
}
}
}
#[test]
fn binding_matches_itself() {
let binding = MockBinding::default();
let identic... |
rust_dataset_chunk_1594 | rust_dataset.txt | 1,594 | 512 | fn binding_matches_modes() {
let b1 = MockBinding {
mode: BindingMode::ALT_SCREEN | BindingMode::APP_KEYPAD,
..MockBinding::default()
};
let b2 = MockBinding { mode: BindingMode::APP_KEYPAD, ..MockBinding::default() };
assert!(b1.triggers_match(&b2));
as... |
rust_dataset_chunk_1595 | rust_dataset.txt | 1,595 | 512 | _CURSOR,
..MockBinding::default()
};
let b2 = MockBinding { notmode: BindingMode::APP_CURSOR, ..MockBinding::default() };
assert!(b1.triggers_match(&b2));
assert!(b2.triggers_match(&b1));
}
#[test]
fn binding_trigger_input() {
let binding = MockBinding {... |
rust_dataset_chunk_1596 | rust_dataset.txt | 1,596 | 512 | use serde::de::Error as SerdeError;
use serde::{Deserialize, Deserializer, Serialize};
use alacritty_config_derive::ConfigDeserialize;
use crate::display::color::{CellRgb, Rgb};
#[derive(ConfigDeserialize, Serialize, Clone, Debug, Default, PartialEq, Eq)]
pub struct Colors {
pub primary: PrimaryColors,
pub c... |
rust_dataset_chunk_1597 | rust_dataset.txt | 1,597 | 512 | 0x18, 0x18)),
background: CellRgb::Rgb(Rgb::new(0xac, 0x42, 0x42)),
}
}
}
#[derive(Deserialize, Serialize, Copy, Clone, Default, Debug, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub struct IndexedColor {
pub color: Rgb,
index: ColorIndex,
}
impl IndexedColor {
#[inline]
pu... |
rust_dataset_chunk_1598 | rust_dataset.txt | 1,598 | 512 | MatchColors {
pub foreground: CellRgb,
pub background: CellRgb,
}
impl Default for MatchColors {
fn default() -> Self {
Self {
background: CellRgb::Rgb(Rgb::new(0xac, 0x42, 0x42)),
foreground: CellRgb::Rgb(Rgb::new(0x18, 0x18, 0x18)),
}
}
}
#[derive(ConfigDeser... |
rust_dataset_chunk_1599 | rust_dataset.txt | 1,599 | 512 | , 0xaa),
white: Rgb::new(0xd8, 0xd8, 0xd8),
}
}
}
#[derive(ConfigDeserialize, Serialize, Clone, Debug, PartialEq, Eq)]
pub struct BrightColors {
pub black: Rgb,
pub red: Rgb,
pub green: Rgb,
pub yellow: Rgb,
pub blue: Rgb,
pub magenta: Rgb,
pub cyan: Rgb,
pub whi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.