Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mtproto TL types #236

Closed

Conversation

TrinhTrungDung
Copy link

No description provided.

Copy link
Owner

@Lonami Lonami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mtproto.tl doesn't need to be updated (not under normal circumstances anyway).

I'd be fine merging some of the other improvements though, which I suspect were all linted by a tool like Clippy. But we need to revert mtproto.tl.

@@ -42,8 +40,8 @@ async fn async_main() -> Result<()> {
.init()
.unwrap();

let api_id = env!("TG_ID").parse().expect("TG_ID invalid");
let api_hash = env!("TG_HASH").to_string();
let api_id = std::env::var("TG_ID")?.parse().expect("TG_ID invalid");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this. The use of env! is intentional, because developers should be compiling the values into the hinary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about add a .cargo/config.toml

[env]
TG_ID = ""
TG_HASH = ""

to avoid error message in example files.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that works, and they can still by overriden by the user, sure.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file don't seem correct.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While bytes and string are synonyms in TL, they're definitely not in Rust.

The Rust String must contain valid UTF-8, and none of the changed types in this file are guaranteed to be valid UTF-8 (and most likely they aren't).

In general, this file shouldn't be updated.

@MOZGIII
Copy link
Contributor

MOZGIII commented Sep 30, 2024

There's a bunch of changes mushed together in a single PR, but it is worth separating them in to separate PRs and discussing separately.
I'd recommend just closing this, especially since it's stale.

@Lonami Lonami closed this Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants