Skip to content

Commit 4329d0b

Browse files
committed
feat: v0.0.2
1 parent f44e188 commit 4329d0b

File tree

6 files changed

+12
-27
lines changed

6 files changed

+12
-27
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "udp-request"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
edition = "2021"
55
authors = ["ltpp-universe <root@ltpp.vip>"]
66
license = "MIT"

src/common/constant.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
pub static EMPTY_STR: &str = "";
22
pub static DEFAULT_WEB_PORT: usize = 80;
3-
pub static SPLIT_REQUEST: &str = "\r\n\r\n";
4-
pub static SPLIT_REQUEST_BYTES: &[u8] = SPLIT_REQUEST.as_bytes();
53
pub static DEFAULT_BUFFER_SIZE: usize = 512_000;
64
pub const DEFAULT_TIMEOUT: u64 = u64::MAX;

src/request/request/impl.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
use crate::*;
22

3+
impl Default for UdpRequest {
4+
#[inline]
5+
fn default() -> Self {
6+
Self {
7+
config: Arc::new(RwLock::new(Config::default())),
8+
response: Arc::new(RwLock::new(UdpResponseBinary::default())),
9+
}
10+
}
11+
}
12+
313
impl UdpRequest {
414
#[inline]
515
fn send_request(
@@ -72,14 +82,3 @@ impl RequestTrait for UdpRequest {
7282
res
7383
}
7484
}
75-
76-
impl Default for UdpRequest {
77-
#[inline]
78-
fn default() -> Self {
79-
Self {
80-
config: Arc::new(RwLock::new(Config::default())),
81-
response: Arc::new(RwLock::new(UdpResponseBinary::default())),
82-
data: Arc::new(RwLock::new(Vec::new())),
83-
}
84-
}
85-
}

src/request/request/type.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::*;
22

33
#[derive(Debug, Clone, Lombok)]
44
pub struct UdpRequest {
5-
pub(crate) data: ArcRwLock<Vec<u8>>,
65
pub(crate) config: ArcRwLock<Config>,
76
pub(crate) response: ArcRwLock<UdpResponseBinary>,
87
}

src/request/request_builder/impl.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ impl RequestBuilder {
4545
self
4646
}
4747

48-
#[inline]
49-
pub fn data<T>(&mut self, data: T) -> &mut Self
50-
where
51-
T: Into<Vec<u8>>,
52-
{
53-
let mut data_clone: Vec<u8> = data.into();
54-
data_clone.extend_from_slice(SPLIT_REQUEST_BYTES);
55-
self.udp_request.data = Arc::new(RwLock::new(data_clone));
56-
self
57-
}
58-
5948
#[inline]
6049
pub fn buffer(&mut self, buffer_size: usize) -> &mut Self {
6150
let _ = self

0 commit comments

Comments
 (0)