//go:build !no_gotd_slices
// +build !no_gotd_slices

// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// MessagesChatsClassArray is adapter for slice of MessagesChatsClass.
type MessagesChatsClassArray []MessagesChatsClass

// Sort sorts slice of MessagesChatsClass.
func ( MessagesChatsClassArray) ( func(,  MessagesChatsClass) bool) MessagesChatsClassArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of MessagesChatsClass.
func ( MessagesChatsClassArray) ( func(,  MessagesChatsClass) bool) MessagesChatsClassArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of MessagesChatsClass.
func ( MessagesChatsClassArray) ( func( MessagesChatsClass) bool) MessagesChatsClassArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( MessagesChatsClassArray) () ( MessagesChatsClass,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( MessagesChatsClassArray) () ( MessagesChatsClass,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *MessagesChatsClassArray) () ( MessagesChatsClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  MessagesChatsClass
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *MessagesChatsClassArray) () ( MessagesChatsClass,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// AsMessagesChats returns copy with only MessagesChats constructors.
func ( MessagesChatsClassArray) () ( MessagesChatsArray) {
	for ,  := range  {
		,  := .(*MessagesChats)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// AsMessagesChatsSlice returns copy with only MessagesChatsSlice constructors.
func ( MessagesChatsClassArray) () ( MessagesChatsSliceArray) {
	for ,  := range  {
		,  := .(*MessagesChatsSlice)
		if ! {
			continue
		}
		 = append(, *)
	}

	return 
}

// MessagesChatsArray is adapter for slice of MessagesChats.
type MessagesChatsArray []MessagesChats

// Sort sorts slice of MessagesChats.
func ( MessagesChatsArray) ( func(,  MessagesChats) bool) MessagesChatsArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of MessagesChats.
func ( MessagesChatsArray) ( func(,  MessagesChats) bool) MessagesChatsArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of MessagesChats.
func ( MessagesChatsArray) ( func( MessagesChats) bool) MessagesChatsArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( MessagesChatsArray) () ( MessagesChats,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( MessagesChatsArray) () ( MessagesChats,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *MessagesChatsArray) () ( MessagesChats,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  MessagesChats
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *MessagesChatsArray) () ( MessagesChats,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}

// MessagesChatsSliceArray is adapter for slice of MessagesChatsSlice.
type MessagesChatsSliceArray []MessagesChatsSlice

// Sort sorts slice of MessagesChatsSlice.
func ( MessagesChatsSliceArray) ( func(,  MessagesChatsSlice) bool) MessagesChatsSliceArray {
	sort.Slice(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// SortStable sorts slice of MessagesChatsSlice.
func ( MessagesChatsSliceArray) ( func(,  MessagesChatsSlice) bool) MessagesChatsSliceArray {
	sort.SliceStable(, func(,  int) bool {
		return ([], [])
	})
	return 
}

// Retain filters in-place slice of MessagesChatsSlice.
func ( MessagesChatsSliceArray) ( func( MessagesChatsSlice) bool) MessagesChatsSliceArray {
	 := 0
	for ,  := range  {
		if () {
			[] = 
			++
		}
	}
	 = [:]

	return 
}

// First returns first element of slice (if exists).
func ( MessagesChatsSliceArray) () ( MessagesChatsSlice,  bool) {
	if len() < 1 {
		return
	}
	return [0], true
}

// Last returns last element of slice (if exists).
func ( MessagesChatsSliceArray) () ( MessagesChatsSlice,  bool) {
	if len() < 1 {
		return
	}
	return [len()-1], true
}

// PopFirst returns first element of slice (if exists) and deletes it.
func ( *MessagesChatsSliceArray) () ( MessagesChatsSlice,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [0]

	// Delete by index from SliceTricks.
	copy([0:], [1:])
	var  MessagesChatsSlice
	[len()-1] = 
	 = [:len()-1]
	* = 

	return , true
}

// Pop returns last element of slice (if exists) and deletes it.
func ( *MessagesChatsSliceArray) () ( MessagesChatsSlice,  bool) {
	if  == nil || len(*) < 1 {
		return
	}

	 := *
	 = [len()-1]
	 = [:len()-1]
	* = 

	return , true
}