We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13a2bd7 commit 479c61bCopy full SHA for 479c61b
tests/tracked_method_inherent_return_deref.rs
@@ -0,0 +1,31 @@
1
+use salsa::Database;
2
+
3
+#[salsa::input]
4
+struct Input {
5
+ number: usize,
6
+}
7
8
+#[salsa::tracked]
9
+impl Input {
10
+ #[salsa::tracked(returns(deref))]
11
+ fn test(self, db: &dyn salsa::Database) -> Vec<String> {
12
+ (0..self.number(db)).map(|i| format!("test {i}")).collect()
13
+ }
14
15
16
+#[test]
17
+fn invoke() {
18
+ salsa::DatabaseImpl::new().attach(|db| {
19
+ let input = Input::new(db, 3);
20
+ let x: &[String] = input.test(db);
21
22
+ assert_eq!(
23
+ x,
24
+ &[
25
+ "test 0".to_string(),
26
+ "test 1".to_string(),
27
+ "test 2".to_string()
28
+ ]
29
+ );
30
+ })
31
0 commit comments