Skip to content

Commit

Permalink
refactor: remove get_mut
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrui committed Jan 3, 2025
1 parent 760f3d4 commit 624a8b4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions core/src/services/memcached/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ impl Connection {
io: BufReader::new(io),
}
}
pub fn get_mut(&mut self) -> &mut Box<dyn Connect> {
self.io.get_mut()
}

pub async fn auth(&mut self, username: &str, password: &str) -> Result<()> {
let writer = self.get_mut();
let writer = self.io.get_mut();
let key = "PLAIN";
let request_header = PacketHeader {
magic: Magic::Request as u8,
Expand All @@ -138,7 +136,7 @@ impl Connection {
}

pub async fn version(&mut self) -> Result<String> {
let writer = self.get_mut();
let writer = self.io.get_mut();
let request_header = PacketHeader {
magic: Magic::Request as u8,
opcode: Opcode::Version as u8,
Expand All @@ -160,7 +158,7 @@ impl Connection {
}

pub async fn get(&mut self, key: &str) -> Result<Option<Vec<u8>>> {
let writer = self.get_mut();
let writer = self.io.get_mut();
let request_header = PacketHeader {
magic: Magic::Request as u8,
opcode: Opcode::Get as u8,
Expand Down Expand Up @@ -189,7 +187,7 @@ impl Connection {
}

pub async fn set(&mut self, key: &str, val: &[u8], expiration: u32) -> Result<()> {
let writer = self.get_mut();
let writer = self.io.get_mut();
let request_header = PacketHeader {
magic: Magic::Request as u8,
opcode: Opcode::Set as u8,
Expand Down Expand Up @@ -226,7 +224,7 @@ impl Connection {
}

pub async fn delete(&mut self, key: &str) -> Result<()> {
let writer = self.get_mut();
let writer = self.io.get_mut();
let request_header = PacketHeader {
magic: Magic::Request as u8,
opcode: Opcode::Delete as u8,
Expand Down

0 comments on commit 624a8b4

Please sign in to comment.