-
Notifications
You must be signed in to change notification settings - Fork 25
Try to implement sabr #335
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
base: main
Are you sure you want to change the base?
Conversation
use reqwest::{Body, Client, Method, Request, Url}; | ||
use serde_json::Value; | ||
use std::error::Error; | ||
use std::str::FromStr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import: std::str::FromStr
.and_then(|v| v.as_array()) | ||
.map(|arr| { | ||
arr.iter() | ||
.filter_map(|item| parse_format_id_from_json(item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant closure
.and_then(|v| v.as_array()) | ||
.map(|arr| { | ||
arr.iter() | ||
.filter_map(|item| parse_format_id_from_json(item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant closure
.and_then(|v| v.as_array()) | ||
.map(|arr| { | ||
arr.iter() | ||
.filter_map(|item| parse_buffered_range_from_json(item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant closure
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct Sequence { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiple fields are never read
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct InitializedFormat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields format_id
, duration_ms
, and sequence_count
are never read
} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct SabrResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fields stream_protection_status
, sabr_redirect
, sabr_error
, and next_request_policy
are never read
} | ||
|
||
#[derive(Debug)] | ||
pub struct UmpPart { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field size
is never read
+ 16 * (byte2 as i32 + 256 * (byte3 as i32 + 256 * byte4 as i32)) | ||
} | ||
_ => { | ||
let value = u32::from_le_bytes([data[1], data[2], data[3], data[4]]) as i32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returning the result of a let
binding from a block
src/main.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
fn get_client_info_from_query(query: &QString) -> ClientInfo { | ||
// Extract client info from query parameters | ||
let client_name = query.get("c").and_then(|c| match c { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Option.and_then(|x| Some(y))
, which is more succinctly expressed as map(|x| y)
pub buffered_ranges: Vec<BufferedRange>, | ||
} | ||
|
||
impl SabrRequestBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
methods with_resolution
, with_visibility
, and encode
are never used
This doesn't work yet.