Skip to content

observed_async_trait no longer compiles outside of the crate #921

@SupernaviX

Description

@SupernaviX

Describe the bug
A recent commit to partner-chains-db-sync-data-sources broke the observed_async_trait macro. That macro relies on calling methods on McFollowerMetrics which were changed from pub to pub(crate).

To Reproduce

This test from the crate fails to compile, as long as you run it outside of the crate.

use async_trait::async_trait;
use partner_chains_db_sync_data_sources::McFollowerMetrics;

struct MetricsMacroTestStruct {
	metrics_opt: Option<McFollowerMetrics>,
}

#[async_trait]
trait MetricMacroTestTrait {
	async fn test_method_one(&self) -> Result<(), Infallible>;
	async fn test_method_two(&self) -> Result<(), Infallible>;
}

observed_async_trait!(
impl MetricMacroTestTrait for MetricsMacroTestStruct {
	async fn test_method_one(&self) -> Result<(), Infallible> {
		tokio::time::sleep(core::time::Duration::from_millis(10)).await;
		Ok(())
	}

	async fn test_method_two(&self) -> Result<(), Infallible> {
		Ok(())
	}
});

Expected behavior
Either this code should compile or all the associated types should be deprecated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions