refactor: generalize write_validated_key_to_tier_files function to use type parameter for file handles

main
Xerxes-2 2025-08-19 16:59:24 +10:00
parent e42b952649
commit 3ca85a4749
No known key found for this signature in database
GPG Key ID: A6C508165D76B601
1 changed files with 7 additions and 4 deletions

View File

@ -6,11 +6,14 @@ use toml::Value;
use tracing::info;
// Write valid key to appropriate tier file
pub async fn write_validated_key_to_tier_files(
free_file: &mut (impl AsyncWrite + Unpin),
paid_file: &mut (impl AsyncWrite + Unpin),
pub async fn write_validated_key_to_tier_files<W>(
free_file: &mut W,
paid_file: &mut W,
validated_key: &ValidatedKey,
) -> Result<(), ValidatorError> {
) -> Result<(), ValidatorError>
where
W: AsyncWrite + Unpin,
{
match validated_key.tier {
KeyTier::Free => {
free_file