From f5499bc27542ca4e67e5251c52d323867cb1cfdd Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Wed, 3 Jan 2024 12:00:50 -0500 Subject: [PATCH] Add Fixture::into_content method Add the ability to get the content of a Fixture by value instead of just by reference. --- dir-test/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dir-test/src/lib.rs b/dir-test/src/lib.rs index aa97827..8da592e 100644 --- a/dir-test/src/lib.rs +++ b/dir-test/src/lib.rs @@ -140,11 +140,16 @@ impl Fixture { Self { content, path } } - /// Returns the content of the fixture. + /// Returns a reference to the content of the fixture. pub fn content(&self) -> &T { &self.content } + /// Consumes the fixture and returns the content. + pub const fn into_content(self) -> T { + self.content + } + /// Returns the absolute path of the fixture. pub const fn path(&self) -> &'static str { self.path