Skip to content

Commit 4384424

Browse files
authored
Use copy for GUID (with copy trait) (#5)
1 parent 9161258 commit 4384424

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

plugin/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl WSLPluginV1 for Plugin {
132132
}
133133

134134
impl Plugin {
135-
fn log_os_release(&self, session: &WSLSessionInformation, distro_id: Option<&GUID>) {
135+
fn log_os_release(&self, session: &WSLSessionInformation, distro_id: Option<GUID>) {
136136
let args: [&str; 2] = ["/bin/cat", "/etc/os-release"];
137137
let tcp_stream: std::result::Result<std::net::TcpStream, api::Error> = match distro_id {
138138
Some(dist_id) => self

wslplugins-rs/src/api/api_v1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl ApiV1<'_> {
210210
pub fn execute_binary_in_distribution<P: AsRef<Utf8UnixPath>>(
211211
&self,
212212
session: &WSLSessionInformation,
213-
distribution_id: &GUID,
213+
distribution_id: GUID,
214214
path: P,
215215
args: &[&str],
216216
) -> Result<TcpStream> {
@@ -235,7 +235,7 @@ impl ApiV1<'_> {
235235
let stream = unsafe {
236236
self.0.ExecuteBinaryInDistribution.unwrap_unchecked()(
237237
session.id(),
238-
distribution_id,
238+
&distribution_id,
239239
path_ptr,
240240
args_ptr,
241241
socket.as_mut_ptr(),

wslplugins-rs/src/core_distribution_information.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pub trait CoreDistributionInformation {
2222
/// The ID is guaranteed to remain the same across reboots.
2323
///
2424
/// # Returns
25-
/// A reference to the [GUID] representing the distribution's unique identifier.
26-
fn id(&self) -> &GUID;
25+
/// The [GUID] representing the distribution's unique identifier.
26+
fn id(&self) -> GUID;
2727

2828
/// Retrieves the name of the distribution.
2929
///

wslplugins-rs/src/distribution_information.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ impl CoreDistributionInformation for DistributionInformation<'_> {
7979
///
8080
/// # Returns
8181
/// A reference to the [GUID] representing the distribution's unique identifier.
82-
fn id(&self) -> &GUID {
83-
&self.0.Id
82+
fn id(&self) -> GUID {
83+
self.0.Id
8484
}
8585

8686
/// Retrieves the name of the distribution.

wslplugins-rs/src/offline_distribution_information.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ impl<'a> OfflineDistributionInformation<'a> {
3939

4040
impl CoreDistributionInformation for OfflineDistributionInformation<'_> {
4141
/// Retrieves the [GUID] of the offline distribution.
42-
fn id(&self) -> &GUID {
43-
&self.0.Id
42+
fn id(&self) -> GUID {
43+
self.0.Id
4444
}
4545

4646
/// Retrieves the name of the offline distribution as an [OsString].

0 commit comments

Comments
 (0)